feat(nvim): added omni & async path

This commit is contained in:
Marvin Drescher
2024-01-15 08:19:47 +01:00
parent 133520eeb6
commit 24e994dfde
2 changed files with 28 additions and 8 deletions

View File

@@ -47,14 +47,18 @@ cmp.setup({
}, },
-- Installed sources: -- Installed sources:
sources = { sources = {
{name = 'path'}, -- file paths {name = 'nvim_lsp', keyword_length = 1}, -- from language server
{name = 'nvim_lsp', keyword_length = 3}, -- from language server
{name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized {name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
{name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.* {name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
{name = 'buffer', keyword_length = 2}, -- source current buffer {
name = 'omni',
option = {disable_omnifuncs = {'v:lua.vim.lsp.omnifunc'}}
}, {name = 'async_path', keyword_length = 3}, -- file paths
{name = 'buffer', keyword_length = 3}, -- source current buffer
{name = 'calc'}, -- source for math calculation {name = 'calc'}, -- source for math calculation
{ {
name = 'spell', name = 'spell',
keyword_length = 4,
option = { option = {
keep_all_entries = false, keep_all_entries = false,
enable_in_context = function() return true end enable_in_context = function() return true end
@@ -72,7 +76,7 @@ cmp.setup({
nvim_lsp = 'λ', nvim_lsp = 'λ',
vsnip = '', vsnip = '',
buffer = '', buffer = '',
path = '', async_path = '',
spell = '', spell = '',
calc = '', calc = '',
crates = '' crates = ''
@@ -90,3 +94,18 @@ cmp.setup.cmdline(':', {
{name = 'cmdline', option = {ignore_cmds = {'Man', '!'}}} {name = 'cmdline', option = {ignore_cmds = {'Man', '!'}}}
}) })
}) })
vim.cmd(':set winhighlight=' .. cmp.config.window.bordered().winhighlight)
-- Setup language servers.
local lspconfig = require('lspconfig')
local deps = require("nvim-deps")
lspconfig.tsserver.setup({
cmd = {
(deps["typescript-language-server_path"] ..
"/bin/typescript-language-server"), "--stdio"
}
})
lspconfig.clangd.setup({cmd = {(deps["clang-tools_path"] .. "/bin/clangd")}})
lspconfig.bashls.setup({
cmd = {(deps["bash-language-server_path"] .. "/bin/bash-language-server")}
})

View File

@@ -46,10 +46,11 @@ in
nvim-dap-ui nvim-dap-ui
nvim-notify nvim-notify
nvim-cmp nvim-cmp
cmp-omni
cmp-nvim-lsp cmp-nvim-lsp
cmp-nvim-lua cmp-nvim-lua
cmp-buffer cmp-buffer
cmp-path cmp-async-path
cmp-spell cmp-spell
cmp-vsnip cmp-vsnip
cmp-conventionalcommits cmp-conventionalcommits
@@ -85,9 +86,9 @@ in
pathsLua = pkgs.writeTextFile { pathsLua = pkgs.writeTextFile {
name = "nvim-deps.lua"; name = "nvim-deps.lua";
text = '' text = ''
return { deps = {}
${concatStringsSep ",\n " (mapAttrsToList (name: path: ''${name}_path = "${path}"'') paths)} ${concatStringsSep "\n " (mapAttrsToList (name: path: ''deps["${name}_path"] = "${path}"'') paths)}
} return deps
''; '';
}; };
confDir = lib.sourceFilesBySuffices ./. [ "lua" "vim" ]; confDir = lib.sourceFilesBySuffices ./. [ "lua" "vim" ];