From 24e994dfde94a0d8456c40da24075462a6e59eeb Mon Sep 17 00:00:00 2001 From: Marvin Drescher Date: Mon, 15 Jan 2024 08:19:47 +0100 Subject: [PATCH] feat(nvim): added omni & async path --- completion.lua | 27 +++++++++++++++++++++++---- default.nix | 9 +++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/completion.lua b/completion.lua index 7d142cb..d42ede6 100644 --- a/completion.lua +++ b/completion.lua @@ -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")} +}) diff --git a/default.nix b/default.nix index ddc7956..34e69e5 100644 --- a/default.nix +++ b/default.nix @@ -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" ];