LSP finally working a decent amount
This commit is contained in:
parent
518951ec2f
commit
9c884fb841
15 changed files with 489 additions and 112 deletions
138
lua/plugins_disabled/cmp.lua
Normal file
138
lua/plugins_disabled/cmp.lua
Normal file
|
@ -0,0 +1,138 @@
|
|||
return {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
opts = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
opts = { store_selection_keys = "<C-x>" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
-- Snips
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-autopairs").setup(opts)
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
-- { "hrsh7th/cmp-nvim-lua" },
|
||||
-- { "hrsh7th/cmp-nvim-lsp" },
|
||||
-- { "hrsh7th/cmp-vsnip" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
-- { "hrsh7th/cmp-cmdline" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
},
|
||||
config = function()
|
||||
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
||||
|
||||
|
||||
local cmp = require("cmp")
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local border_opts = {
|
||||
border = "single",
|
||||
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None",
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
enabled = function()
|
||||
local dap_prompt = vim.tbl_contains(
|
||||
{ "dap-repl", "dapui_watches", "dapui_hover" },
|
||||
vim.api.nvim_get_option_value("filetype", { buf = 0 })
|
||||
)
|
||||
if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" and not dap_prompt then
|
||||
return false
|
||||
end
|
||||
return vim.g.cmp_enabled
|
||||
end,
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(border_opts),
|
||||
documentation = cmp.config.window.bordered(border_opts),
|
||||
},
|
||||
preselect = cmp.PreselectMode.None,
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = lspkind_status_ok and lspkind.cmp_format(utils.plugin_opts("lspkind.nvim")) or nil,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
duplicates = {
|
||||
nvim_lsp = 1,
|
||||
luasnip = 1,
|
||||
cmp_tabnine = 1,
|
||||
buffer = 1,
|
||||
path = 1,
|
||||
},
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable,
|
||||
["<C-e>"] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750 },
|
||||
{ name = "buffer", priority = 500 },
|
||||
{ name = "path", priority = 250 },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/neodev.nvim",
|
||||
opts = {}
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
"simrat39/rust-tools.nvim",
|
||||
event = "BufEnter *.rs",
|
||||
after = { "mason-lspconfig.nvim", "inlay-hints." },
|
||||
}
|
3
lua/plugins_disabled/tabstops_sleuth.lua
Normal file
3
lua/plugins_disabled/tabstops_sleuth.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
'tpope/vim-sleuth',
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue