diff --git a/lua/config/keymaping.lua b/lua/config/keymaping.lua index f0b049d..3310a0b 100644 --- a/lua/config/keymaping.lua +++ b/lua/config/keymaping.lua @@ -2,3 +2,7 @@ local map = vim.keymap.set map("n", "e", ":Neotree", { desc = "nvimtree focus window" }) +-- telescope +map("n", "ff", "Telescope live_grep", { desc = "telescope live grep" }) +map("n", "gr", "Telescope lsp_references", { desc = "telescope lsp references" }) + diff --git a/lua/config/options.lua b/lua/config/options.lua index eee8d76..cf6a669 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -4,7 +4,7 @@ local g = vim.g g.mapleader = " " -o.laststatus = 2 +o.laststatus = 3 o.showmode = false o.clipboard = "unnamedplus" diff --git a/lua/plugins/barbar.lua b/lua/plugins/barbar.lua new file mode 100644 index 0000000..54449d4 --- /dev/null +++ b/lua/plugins/barbar.lua @@ -0,0 +1,22 @@ +local g = vim.g + +return { + "romgrk/barbar.nvim", + dependencies = { + "lewis6991/gitsigns.nvim", -- OPTIONAL: for git status + "nvim-tree/nvim-web-devicons", -- OPTIONAL: for file icons + }, + init = function() + g.barbar_auto_setup = false + end, + opts = { + -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: + animation = true, + insert_at_start = true, + auto_hide = true, + sidebar_filetypes = { + ["neo-tree"] = { event = "BufWipeout" }, + }, + -- …etc. + }, +} diff --git a/lua/plugins/blankline.lua b/lua/plugins/blankline.lua index a1e1bc9..84cbd72 100644 --- a/lua/plugins/blankline.lua +++ b/lua/plugins/blankline.lua @@ -1,7 +1,7 @@ return { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - ---@module "ibl" - ---@type ibl.config - opts = {}, + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + ---@module "ibl" + ---@type ibl.config + opts = {}, } diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..6de2243 --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,18 @@ +return { + "stevearc/conform.nvim", + --opts = {}, + config = function() + require("conform").setup({ + formatters_by_ft = { + lua = { "stylua" }, + }, + }) + + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*", + callback = function(args) + require("conform").format({ bufnr = args.buf }) + end, + }) + end, +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 8a46265..405db5d 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -1,12 +1,12 @@ return { - "lewis6991/gitsigns.nvim", - event = "User FilePost", - opts = function() - return { - signs = { - delete = { text = "󰍵" }, - changedelete = { text = "󱕖" }, - }, - } - end, + "lewis6991/gitsigns.nvim", + event = "User FilePost", + opts = function() + return { + signs = { + delete = { text = "󰍵" }, + changedelete = { text = "󱕖" }, + }, + } + end, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..d7fb2b5 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,50 @@ +return { + -- Main LSP Configuration + 'neovim/nvim-lspconfig', + + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + { + 'williamboman/mason.nvim', config = true, + }, -- NOTE: Must be loaded before dependants + 'williamboman/mason-lspconfig.nvim', + --'WhoIsSethDaniel/mason-tool-installer.nvim', + --{ 'j-hui/fidget.nvim', opts = {} }, + 'hrsh7th/cmp-nvim-lsp', + }, + + config = function() + --local capabilities = vim.lsp.protocol.make_client_capabilities() + --capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + + local servers = { + gopls = {}, + } + + require('mason').setup() + + --local ensure_installed = vim.tbl_keys(servers or {}) + --vim.list_extend(ensure_installed, { + -- 'stylua', -- Used to format Lua code + --}) + + --require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + require('mason-lspconfig').setup { + handlers = { + function(server_name) + + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + + + local server = servers[server_name] or {} + server.capabilities = capabilities + -- server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + end, +} + diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..8bfff8c --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,71 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + -- { + -- snippet plugin + -- "L3MON4D3/LuaSnip", + -- dependencies = "rafamadriz/friendly-snippets", + -- opts = { history = true, updateevents = "TextChanged,TextChangedI" }, + -- config = function(_, opts) + -- require("luasnip").config.set_config(opts) + -- require "nvchad.configs.luasnip" + -- end, + --}, + + -- autopairing of (){}[] etc + --{ + -- "windwp/nvim-autopairs", + -- opts = { + -- fast_wrap = {}, + -- disable_filetype = { "TelescopePrompt", "vim" }, + -- }, + -- config = function(_, opts) + -- require("nvim-autopairs").setup(opts) +-- + -- setup cmp for autopairs + -- local cmp_autopairs = require "nvim-autopairs.completion.cmp" + -- require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done()) + -- end, + -- }, + + -- cmp sources plugins + --{ + -- "saadparwaiz1/cmp_luasnip", + --"hrsh7th/cmp-nvim-lua", + -- "hrsh7th/cmp-nvim-lsp", + -- "hrsh7th/cmp-buffer", + -- "hrsh7th/cmp-path", + -- }, + }, + config = function() + local cmp = require('cmp') +-- snippet = { + -- REQUIRED - you must specify a snippet engine + -- expand = function(args) + -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) + --end, + --}, + + cmp.setup({ + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.complete(), +[''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + }), + }) + end + --opts = function() + -- return require "nvchad.configs.cmp" + --end, + } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..560ea94 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,8 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + -- cmd = "Telescope", + opts = function() + -- return require "nvchad.configs.telescope" + end, + }