modified lsp config.

This commit is contained in:
Gabe Venberg 2022-06-16 11:30:25 -05:00
parent 1796fdbbf9
commit e90208c701
4 changed files with 76 additions and 100 deletions

View file

@ -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)

View file

@ -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', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
on_attach()
install_servers()

View file

@ -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' },
})
})

View file

@ -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 = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
{ key = "<C-e>", action = "edit_in_place" },
{ key = {"O"}, action = "edit_no_picker" },
{ key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
{ key = "<C-v>", action = "vsplit" },
{ key = "<C-x>", action = "split" },
{ key = "<C-t>", action = "tabnew" },
{ key = "<", action = "prev_sibling" },
{ key = ">", action = "next_sibling" },
{ key = "P", action = "parent_node" },
{ key = "<BS>", action = "close_node" },
{ key = "<Tab>", 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 = "<C-r>", 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 = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
-- { key = "<C-e>", action = "edit_in_place" },
-- { key = {"O"}, action = "edit_no_picker" },
-- { key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
-- { key = "<C-v>", action = "vsplit" },
-- { key = "<C-x>", action = "split" },
-- { key = "<C-t>", action = "tabnew" },
-- { key = "<", action = "prev_sibling" },
-- { key = ">", action = "next_sibling" },
-- { key = "P", action = "parent_node" },
-- { key = "<BS>", action = "close_node" },
-- { key = "<Tab>", 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 = "<C-r>", 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
}