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:
sources = {
{name = 'path'}, -- file paths
{name = 'nvim_lsp', keyword_length = 3}, -- from language server
{name = 'nvim_lsp', keyword_length = 1}, -- from language server
{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 = '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 = 'spell',
keyword_length = 4,
option = {
keep_all_entries = false,
enable_in_context = function() return true end
@@ -72,7 +76,7 @@ cmp.setup({
nvim_lsp = 'λ',
vsnip = '',
buffer = '',
path = '',
async_path = '',
spell = '',
calc = '',
crates = ''
@@ -90,3 +94,18 @@ cmp.setup.cmdline(':', {
{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-notify
nvim-cmp
cmp-omni
cmp-nvim-lsp
cmp-nvim-lua
cmp-buffer
cmp-path
cmp-async-path
cmp-spell
cmp-vsnip
cmp-conventionalcommits
@@ -85,9 +86,9 @@ in
pathsLua = pkgs.writeTextFile {
name = "nvim-deps.lua";
text = ''
return {
${concatStringsSep ",\n " (mapAttrsToList (name: path: ''${name}_path = "${path}"'') paths)}
}
deps = {}
${concatStringsSep "\n " (mapAttrsToList (name: path: ''deps["${name}_path"] = "${path}"'') paths)}
return deps
'';
};
confDir = lib.sourceFilesBySuffices ./. [ "lua" "vim" ];