feat(plugins): clean up
This commit is contained in:
parent
9211e64849
commit
ff3a7a5de4
4 changed files with 45 additions and 42 deletions
|
@ -2,7 +2,6 @@ local M = {}
|
|||
|
||||
M.init = function()
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
vim.cmd([[
|
||||
autocmd FileType TelescopePrompt lua require('cmp').setup.buffer { enabled = false }
|
||||
|
@ -16,7 +15,7 @@ M.init = function()
|
|||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
|
@ -35,8 +34,8 @@ M.init = function()
|
|||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif require('luasnip').expand_or_jumpable() then
|
||||
require('luasnip').expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
|
@ -49,8 +48,8 @@ M.init = function()
|
|||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
elseif require('luasnip').jumpable(-1) then
|
||||
require('luasnip').jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
|
|
@ -37,19 +37,19 @@ function M.on_attach(client, bufnr)
|
|||
client.resolved_capabilities.document_range_formatting = false
|
||||
end
|
||||
|
||||
require('lsp_signature').on_attach({
|
||||
--[[ require('lsp_signature').on_attach({
|
||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||
handler_opts = {
|
||||
border = 'single',
|
||||
},
|
||||
}, bufnr)
|
||||
}, bufnr) ]]
|
||||
end
|
||||
|
||||
M.flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
|
||||
local function get_capabilities()
|
||||
--[[ local function get_capabilities()
|
||||
local ok, cmp_nvim_lsp = pcall(require, 'cmp_nvim_lsp')
|
||||
if not ok then
|
||||
return {}
|
||||
|
@ -57,7 +57,8 @@ local function get_capabilities()
|
|||
return cmp_nvim_lsp.update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
end
|
||||
|
||||
M.capabilities = get_capabilities()
|
||||
M.capabilities = get_capabilities() ]]
|
||||
M.capabilities = {}
|
||||
|
||||
M.root_dir = function(fname)
|
||||
local util = require('lspconfig').util
|
||||
|
|
|
@ -35,7 +35,6 @@ for config_server, config_opt in pairs(config.lsp.servers) do
|
|||
table.insert(disabled_servers, config_server)
|
||||
elseif not vim.tbl_contains(requested_servers, config_server) then
|
||||
-- add additonally defined servers to be installed
|
||||
-- todo: how to handle non-default server opts?
|
||||
table.insert(requested_servers, config_server)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -91,27 +91,25 @@ return packer.startup(function()
|
|||
|
||||
use({
|
||||
'neovim/nvim-lspconfig',
|
||||
requires = {
|
||||
{
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
after = 'nvim-lspconfig',
|
||||
},
|
||||
{
|
||||
'jose-elias-alvarez/nvim-lsp-ts-utils',
|
||||
after = 'cmp-nvim-lsp',
|
||||
},
|
||||
{
|
||||
'ray-x/lsp_signature.nvim',
|
||||
after = 'nvim-lsp-ts-utils',
|
||||
},
|
||||
{ 'onsails/lspkind-nvim', after = 'lsp_signature.nvim' },
|
||||
{
|
||||
'williamboman/nvim-lsp-installer',
|
||||
after = 'lspkind-nvim',
|
||||
config = function()
|
||||
require('cosmic.lsp')
|
||||
end,
|
||||
requires = {
|
||||
{
|
||||
'ray-x/lsp_signature.nvim',
|
||||
config = function()
|
||||
-- must happen after servers are set up
|
||||
require('lsp_signature').setup({
|
||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||
handler_opts = {
|
||||
border = 'rounded',
|
||||
},
|
||||
})
|
||||
end,
|
||||
after = 'nvim-lspconfig',
|
||||
},
|
||||
{ 'jose-elias-alvarez/nvim-lsp-ts-utils' },
|
||||
{ 'williamboman/nvim-lsp-installer' },
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -121,18 +119,12 @@ return packer.startup(function()
|
|||
require('cosmic.lsp.providers.null_ls')
|
||||
end,
|
||||
requires = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
|
||||
disable = vim.tbl_contains(user_plugins.disable, 'null-ls'),
|
||||
})
|
||||
|
||||
use({
|
||||
'L3MON4D3/LuaSnip',
|
||||
config = function()
|
||||
require('cosmic.core.snippets')
|
||||
end,
|
||||
requires = {
|
||||
{
|
||||
'rafamadriz/friendly-snippets',
|
||||
},
|
||||
},
|
||||
'onsails/lspkind-nvim',
|
||||
event = 'InsertEnter',
|
||||
disable = vim.tbl_contains(user_plugins.disable, 'autocomplete'),
|
||||
})
|
||||
|
||||
|
@ -143,20 +135,32 @@ return packer.startup(function()
|
|||
require('cosmic.lsp.autocomplete').init()
|
||||
end,
|
||||
requires = {
|
||||
{ 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp' },
|
||||
{ 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp' },
|
||||
{ 'saadparwaiz1/cmp_luasnip', after = 'cmp-nvim-lsp' },
|
||||
{ 'hrsh7th/cmp-buffer', after = 'cmp_luasnip' },
|
||||
{ 'hrsh7th/cmp-nvim-lua', after = 'cmp-buffer' },
|
||||
{ 'hrsh7th/cmp-path', after = 'cmp-nvim-lua' },
|
||||
},
|
||||
event = 'InsertEnter',
|
||||
})
|
||||
|
||||
use({
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
config = function()
|
||||
require('cosmic.lsp.autocomplete').autopairs()
|
||||
end,
|
||||
after = 'nvim-cmp',
|
||||
after = 'cmp-path',
|
||||
},
|
||||
},
|
||||
after = 'lspkind-nvim',
|
||||
disable = vim.tbl_contains(user_plugins.disable, 'autocomplete'),
|
||||
})
|
||||
|
||||
use({
|
||||
'L3MON4D3/LuaSnip',
|
||||
config = function()
|
||||
require('cosmic.core.snippets')
|
||||
end,
|
||||
requires = {
|
||||
'rafamadriz/friendly-snippets',
|
||||
},
|
||||
disable = vim.tbl_contains(user_plugins.disable, 'autocomplete'),
|
||||
})
|
||||
|
||||
-- git commands
|
||||
|
|
Loading…
Add table
Reference in a new issue