fix: cmp finally works?
This commit is contained in:
parent
1c9bf7056c
commit
6e570fbc2e
@ -1,7 +1,7 @@
|
|||||||
-- theming
|
-- theming
|
||||||
-- Default options
|
-- Default options
|
||||||
--vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
--vim.cmd.colorscheme 'duskfox'
|
vim.cmd.colorscheme 'duskfox'
|
||||||
|
|
||||||
-- turn on relative line numbers
|
-- turn on relative line numbers
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
@ -52,16 +52,6 @@ vim.cmd([[
|
|||||||
au BufNewFile,BufRead *.hrl filetype indent off
|
au BufNewFile,BufRead *.hrl filetype indent off
|
||||||
]])
|
]])
|
||||||
|
|
||||||
----Set completeopt to have a better completion experience
|
|
||||||
---- :help completeopt
|
|
||||||
---- menuone: popup even when there's only one match
|
|
||||||
---- noinsert: Do not insert text until a selection is made
|
|
||||||
---- noselect: Do not select, force to select one from the menu
|
|
||||||
---- shortness: avoid showing extra messages when using completion
|
|
||||||
---- updatetime: set updatetime for CursorHold
|
|
||||||
--vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'}
|
|
||||||
--vim.opt.shortmess = vim.opt.shortmess + { c = true}
|
|
||||||
--vim.api.nvim_set_option('updatetime', 300)
|
|
||||||
--
|
--
|
||||||
--https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
--https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
-- TODO(jwall): See about proper snippet support (ie. license comments?)
|
-- TODO(jwall): See about proper snippet support (ie. license comments?)
|
||||||
@ -74,7 +64,16 @@ cmp.setup({
|
|||||||
vim.fn["vsnip#anonymous"](args.body)
|
vim.fn["vsnip#anonymous"](args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert(),
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
-- Installed sources:
|
-- Installed sources:
|
||||||
sources = cmp.config.sources(
|
sources = cmp.config.sources(
|
||||||
{
|
{
|
||||||
@ -93,32 +92,13 @@ cmp.setup({
|
|||||||
completion = cmp.config.window.bordered(),
|
completion = cmp.config.window.bordered(),
|
||||||
documentation = cmp.config.window.bordered(),
|
documentation = cmp.config.window.bordered(),
|
||||||
},
|
},
|
||||||
formatting = {
|
|
||||||
fields = {'menu', 'abbr', 'kind'},
|
|
||||||
format = function(entry, item)
|
|
||||||
local menu_icon ={
|
|
||||||
nvim_lsp = 'λ',
|
|
||||||
vsnip = '⋗',
|
|
||||||
buffer = 'Ω',
|
|
||||||
path = '🖫',
|
|
||||||
}
|
|
||||||
item.menu = menu_icon[entry.source.name]
|
|
||||||
return item
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local caps = vim.tbl_deep_extend(
|
|
||||||
'force',
|
|
||||||
vim.lsp.protocol.make_client_capabilities(),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
-- Nix language server support
|
-- Nix language server support
|
||||||
lspconfig.nil_ls.setup{}
|
--lspconfig.nil_ls.setup{}
|
||||||
|
|
||||||
local vim_pid = vim.fn.getpid()
|
local vim_pid = vim.fn.getpid()
|
||||||
|
|
||||||
@ -149,16 +129,23 @@ lspconfig.omnisharp.setup {
|
|||||||
handlers = {
|
handlers = {
|
||||||
["textDocument/definition"] = require('omnisharp_extended').handler,
|
["textDocument/definition"] = require('omnisharp_extended').handler,
|
||||||
},
|
},
|
||||||
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
--ocaml
|
--ocaml
|
||||||
lspconfig.ocamllsp.setup{}
|
lspconfig.ocamllsp.setup{
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
|
||||||
-- Java language server support
|
-- Java language server support
|
||||||
lspconfig.java_language_server.setup{}
|
lspconfig.java_language_server.setup{
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
|
||||||
-- Typescript language server support
|
-- Typescript language server support
|
||||||
lspconfig.tsserver.setup{}
|
lspconfig.tsserver.setup{
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
|
||||||
-- Rust language server support
|
-- Rust language server support
|
||||||
lspconfig.rust_analyzer.setup{
|
lspconfig.rust_analyzer.setup{
|
||||||
@ -167,7 +154,7 @@ lspconfig.rust_analyzer.setup{
|
|||||||
|
|
||||||
-- lua language server setup.
|
-- lua language server setup.
|
||||||
lspconfig.lua_ls.setup{
|
lspconfig.lua_ls.setup{
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = { version = 'LuaJIT', },
|
runtime = { version = 'LuaJIT', },
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
@ -185,6 +172,7 @@ lspconfig.lua_ls.setup{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
-- lsp configuration
|
-- lsp configuration
|
||||||
|
6
nix/darwin/flake.lock
generated
6
nix/darwin/flake.lock
generated
@ -34,12 +34,12 @@
|
|||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1,
|
"lastModified": 1,
|
||||||
"narHash": "sha256-uA4sSuHPv0RuNibC98a+mBh/GnMS1vXrwFIE1XP8AIs=",
|
"narHash": "sha256-KJ88AyD8/ZvqJOPPQmIlima5o21MEmFOOJzXRyGAfdE=",
|
||||||
"path": "/nix/store/pzjnc2vf0y96kai86a1m9m54m33lxwpq-source/nix/base-system",
|
"path": "/nix/store/bb6cc8gqhmh7rx05pyamshg1cq9bvrrh-source/nix/base-system",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/pzjnc2vf0y96kai86a1m9m54m33lxwpq-source/nix/base-system",
|
"path": "/nix/store/bb6cc8gqhmh7rx05pyamshg1cq9bvrrh-source/nix/base-system",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user