diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index 96573f1..c765de6 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -10,9 +10,6 @@ vim.g.mapleader = ';' --do package management require('impatient') require('packages') -require('LSPconfig') -require('cmp-lsp') - --helper functions local function keyCode(string) diff --git a/neovim/.config/nvim/lua/LSPconfig.lua b/neovim/.config/nvim/lua/LSPconfig.lua index 95c0ad2..0f7402b 100644 --- a/neovim/.config/nvim/lua/LSPconfig.lua +++ b/neovim/.config/nvim/lua/LSPconfig.lua @@ -1,50 +1,6 @@ local lsp_installer = require("nvim-lsp-installer") - --- Include the servers you want to have installed by default below -local install_servers=function() - local servers = { - 'pyright', - 'bashls', - 'rust_analyzer', - 'sumenko_lua', - 'ltex', - 'texlab', - } - - local flag=false; - for _, name in pairs(servers) do - local server_is_found, server = lsp_installer.get_server(name) - if server_is_found and not server:is_installed() then - print("Installing " .. name) - server:install() - flag=true; - end - end - if flag then - print('All Servers Installed') - end -end - -lsp_installer.on_server_ready(function(server) - local opts = {} - - if server.name == "rust_analyzer" then - -- Initialize the LSP via rust-tools instead - require("rust-tools").setup { - -- The "server" property provided in rust-tools setup function are the - -- settings rust-tools will provide to lspconfig during init. - -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) - -- with the user's own settings (opts). - server = vim.tbl_deep_extend("force", server:get_default_options(), opts), - } - server:attach_buffers() - -- Only if standalone support is needed - require("rust-tools").start_standalone_if_required() - else - server:setup(opts) - end -end) +local opts = {} local on_attach = function() local function set_keymap(...) vim.api.nvim_set_keymap(...) end @@ -75,4 +31,3 @@ local on_attach = function() set_keymap('', ';lm', 'lua vim.lsp.buf.formatting()', opts) end on_attach() -install_servers() diff --git a/neovim/.config/nvim/lua/cmp-lsp.lua b/neovim/.config/nvim/lua/cmp-lsp.lua index a89a2bd..90e585b 100644 --- a/neovim/.config/nvim/lua/cmp-lsp.lua +++ b/neovim/.config/nvim/lua/cmp-lsp.lua @@ -47,27 +47,22 @@ cmp.setup { { name = 'nvim_lsp' }, { name = 'path' }, { name = 'luasnip' }, - { name = 'buffer' }, - { name = 'dictionary' }, - { name = 'spell' }, { name = 'nvim_lsp_signature_help' }, { name = 'emoji' }, { name = 'latex_symbols' }, + -- { name = 'buffer' }, -- { name = 'digraphs' }, + -- { name = 'dictionary' }, + -- { name = 'spell' }, }, } -cmp.setup.cmdline(':', { - sources = { - { name = 'cmdline' } - } -}) - cmp.setup.cmdline('/', { sources = cmp.config.sources({ { name = 'nvim_lsp_document_symbol' }, { name = 'treesitter' }, }, { - -- { name = 'buffer' } + { name = 'buffer' }, + { name = 'cmdline' }, }) }) diff --git a/neovim/.config/nvim/lua/packages.lua b/neovim/.config/nvim/lua/packages.lua index 2b2599d..f4fea6b 100644 --- a/neovim/.config/nvim/lua/packages.lua +++ b/neovim/.config/nvim/lua/packages.lua @@ -24,10 +24,36 @@ return require('packer').startup(function(use) incremental_selection={enable=true} }end, } - use { - 'neovim/nvim-lspconfig', - 'williamboman/nvim-lsp-installer', + { + "williamboman/nvim-lsp-installer", + config = function () + require("nvim-lsp-installer").setup { + ensure_installed = { + 'pyright', + 'bashls', + 'rust_analyzer', + 'sumenko_lua', + 'texlab', + }, + automatic_installation = false, + ui = { + icons = { + server_installed = "✓", + server_pending = "➜", + server_uninstalled = "✗" + } + } + } + end + }, + { + "neovim/nvim-lspconfig", + after = "nvim-lsp-installer", + config = function() + require('LSPconfig') + end + } } use {'hrsh7th/nvim-cmp', @@ -46,7 +72,10 @@ return require('packer').startup(function(use) 'hrsh7th/cmp-emoji', 'ray-x/cmp-treesitter', 'uga-rosa/cmp-dictionary', - } + }, + config = function() + require('cmp-lsp') + end } use {'L3MON4D3/LuaSnip', @@ -75,43 +104,43 @@ return require('packer').startup(function(use) 'kyazdani42/nvim-web-devicons', -- optional, for file icon }, config = function() require'nvim-tree'.setup { - view={mapping={ - { key = {"", "o", "<2-LeftMouse>"}, action = "edit" }, - { key = "", action = "edit_in_place" }, - { key = {"O"}, action = "edit_no_picker" }, - { key = {"<2-RightMouse>", ""}, action = "cd" }, - { key = "", action = "vsplit" }, - { key = "", action = "split" }, - { key = "", action = "tabnew" }, - { key = "<", action = "prev_sibling" }, - { key = ">", action = "next_sibling" }, - { key = "P", action = "parent_node" }, - { key = "", action = "close_node" }, - { key = "", action = "preview" }, - { key = "K", action = "first_sibling" }, - { key = "J", action = "last_sibling" }, - { key = "I", action = "toggle_ignored" }, - { key = "H", action = "toggle_dotfiles" }, - { key = "R", action = "refresh" }, - { key = "a", action = "create" }, - { key = "d", action = "remove" }, - { key = "D", action = "trash" }, - { key = "r", action = "rename" }, - { key = "", action = "full_rename" }, - { key = "x", action = "cut" }, - { key = "c", action = "copy" }, - { key = "p", action = "paste" }, - { key = "y", action = "copy_name" }, - { key = "Y", action = "copy_path" }, - { key = "gy", action = "copy_absolute_path" }, - { key = "[c", action = "prev_git_item" }, - { key = "]c", action = "next_git_item" }, - { key = "-", action = "dir_up" }, - { key = "s", action = "system_open" }, - { key = "q", action = "close" }, - { key = "g?", action = "toggle_help" }, - { key = "W", action = "collapse_all" } - }} + -- view={mapping={ + -- { key = {"", "o", "<2-LeftMouse>"}, action = "edit" }, + -- { key = "", action = "edit_in_place" }, + -- { key = {"O"}, action = "edit_no_picker" }, + -- { key = {"<2-RightMouse>", ""}, action = "cd" }, + -- { key = "", action = "vsplit" }, + -- { key = "", action = "split" }, + -- { key = "", action = "tabnew" }, + -- { key = "<", action = "prev_sibling" }, + -- { key = ">", action = "next_sibling" }, + -- { key = "P", action = "parent_node" }, + -- { key = "", action = "close_node" }, + -- { key = "", action = "preview" }, + -- { key = "K", action = "first_sibling" }, + -- { key = "J", action = "last_sibling" }, + -- { key = "I", action = "toggle_ignored" }, + -- { key = "H", action = "toggle_dotfiles" }, + -- { key = "R", action = "refresh" }, + -- { key = "a", action = "create" }, + -- { key = "d", action = "remove" }, + -- { key = "D", action = "trash" }, + -- { key = "r", action = "rename" }, + -- { key = "", action = "full_rename" }, + -- { key = "x", action = "cut" }, + -- { key = "c", action = "copy" }, + -- { key = "p", action = "paste" }, + -- { key = "y", action = "copy_name" }, + -- { key = "Y", action = "copy_path" }, + -- { key = "gy", action = "copy_absolute_path" }, + -- { key = "[c", action = "prev_git_item" }, + -- { key = "]c", action = "next_git_item" }, + -- { key = "-", action = "dir_up" }, + -- { key = "s", action = "system_open" }, + -- { key = "q", action = "close" }, + -- { key = "g?", action = "toggle_help" }, + -- { key = "W", action = "collapse_all" } + -- }} } end }