From a4f25f1850bb92c85206ba8e4c61ec0121f5020f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Fri, 7 Jun 2024 00:29:15 +0300 Subject: lsp: set icons and organize config * Set icons for LSP diagnostics and completion. * Move the lua part of the config into a different file. --- dotfiles/.config/nvim/init.vim | 8 ++----- dotfiles/.config/nvim/lua.lua | 49 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 dotfiles/.config/nvim/lua.lua (limited to 'dotfiles/.config') diff --git a/dotfiles/.config/nvim/init.vim b/dotfiles/.config/nvim/init.vim index 2189149..95d7a63 100644 --- a/dotfiles/.config/nvim/init.vim +++ b/dotfiles/.config/nvim/init.vim @@ -256,14 +256,10 @@ call plug#end() " LSP if has('nvim-0.6') set omnifunc=v:lua.vim.lsp.omnifunc - lua require('lspconfig').clangd.setup{filetypes = { "c", "cpp", "objc", "objcpp", "ch" }} - lua require('lspconfig').gopls.setup{} - lua require('lspconfig').pylsp.setup{} - lua require('lspconfig').rls.setup{} - lua require('lspconfig').quick_lint_js.setup{} - lua require('lspfuzzy').setup{} + source ~/.config/nvim/lua.lua endif + " LSP keybinds nmap gd lua vim.lsp.buf.definition() nmap gD lua vim.lsp.buf.declaration() diff --git a/dotfiles/.config/nvim/lua.lua b/dotfiles/.config/nvim/lua.lua new file mode 100644 index 0000000..8514d19 --- /dev/null +++ b/dotfiles/.config/nvim/lua.lua @@ -0,0 +1,49 @@ +-- LSP configuration + +local lspconfig = require('lspconfig') + +lspconfig.clangd.setup{filetypes = { "c", "cpp", "objc", "objcpp", "ch" }} +lspconfig.gopls.setup{} +lspconfig.pylsp.setup{} +lspconfig.rls.setup{} +lspconfig.quick_lint_js.setup{} +require('lspfuzzy').setup{} + +local lsp_icons = { + Class = " ", + Color = " ", + Constant = " ", + Constructor = " ", + Enum = " ", + EnumMember = " ", + Field = "󰄶 ", + File = " ", + Folder = " ", + Function = "ƒ ", + Interface = "󰜰", + Keyword = "󰌆 ", + Method = "∫ ", + Module = "󰏗 ", + Property = " ", + Snippet = "󰘍 ", + Struct = " ", + Text = " ", + Unit = " ", + Value = "󰎠 ", + Variable = " ", +} + + +function lsp_icons_setup() + local kinds = vim.lsp.protocol.CompletionItemKind + for i, kind in ipairs(kinds) do + kinds[i] = lsp_icons[kind] or kind + end +end + +lsp_icons_setup() + +vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' }) +vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' }) +vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' }) +vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' }) -- cgit v1.2.3