diff options
author | Soispha <soispha@vhack.eu> | 2023-08-29 21:33:43 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-08-29 21:33:43 +0200 |
commit | 3925f6ee04f09d7d09b7aff018812670a0e89492 (patch) | |
tree | 12642e7332ebb53153bef1bf5d5f811e3f19884b /hm/soispha/conf/nvim/plgs/lsp | |
parent | Feat(hm/conf/nvim/plgs/debugprint): Init (diff) | |
download | nixos-config-3925f6ee04f09d7d09b7aff018812670a0e89492.zip |
Refactor(hm/conf/nvim/plugins): Rename to `plgs` to safe commit msg space
Diffstat (limited to 'hm/soispha/conf/nvim/plgs/lsp')
10 files changed, 196 insertions, 0 deletions
diff --git a/hm/soispha/conf/nvim/plgs/lsp/default.nix b/hm/soispha/conf/nvim/plgs/lsp/default.nix new file mode 100644 index 00000000..b7c1e174 --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/default.nix @@ -0,0 +1,29 @@ +{...}: { + imports = [ + ./keymaps + ./servers + ]; + programs.nixvim.plugins.lsp = { + enable = true; + onAttach = + "" + # + '' + # function(client, bufnr) + # -- Enable completion triggered by <c-x><c-o> + # -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + # end + # '' + ; + preConfig = '' + vim.diagnostic.config({ + underline = true, + -- virtual_text = true, + virtual_text = { + source = "always", -- Or "if_many" + }, + update_in_insert = true, + severity_sort = true, + }, nil); + ''; + }; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/keymaps/default.nix b/hm/soispha/conf/nvim/plgs/lsp/keymaps/default.nix new file mode 100644 index 00000000..4017521d --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/keymaps/default.nix @@ -0,0 +1,72 @@ +{...}: { + programs.nixvim = { + plugins.lsp.keymaps = { + diagnostic = { + "N" = { + action = "goto_prev"; + desc = "go to previous diagnostic message"; + }; + "T" = { + action = "goto_next"; + desc = "go to next diagnostic message"; + }; + "<space>e" = { + action = "open_float"; + desc = "open float for the symbol"; + }; + "<space>gq" = { + action = "setloclist"; + desc = "add buffer diagnostic to the location list (quick-fix)"; + }; + }; + lspBuf = { + "<space>gD" = { + action = "declaration"; + desc = "[G]o to [d]eclaration"; + }; + "<space>hi" = { + action = "hover"; + desc = "Display [h]over [i]nformation"; + }; + "<space>sh" = { + action = "signature_help"; + desc = "Display [s]ignature [h]elp"; + }; + "<space>wa" = { + action = "add_workspace_folder"; + desc = "[W]orkspace folder [a]dd"; + }; + "<space>wr" = { + action = "remove_workspace_folder"; + desc = "[W]orkspace folder [r]emove"; + }; + "<space>rn" = { + action = "rename"; + desc = "[R]e[n]ame the item under the cursor"; + }; + "<space>ca" = { + action = "code_action"; + desc = "Open the [c]ode [a]ction menu"; + }; + }; + }; + maps = { + normal = { + "<space>f" = { + action = "function() vim.lsp.buf.format { async = true } end"; + lua = true; + desc = "[F]ormat the current buffer (asynchronously)"; + }; + "<space>wl" = { + action = '' + function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end + ''; + lua = true; + desc = "[W]orkspace folders [l]ist"; + }; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/servers/default.nix b/hm/soispha/conf/nvim/plgs/lsp/servers/default.nix new file mode 100644 index 00000000..8ffac2e1 --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/servers/default.nix @@ -0,0 +1,11 @@ +{...}: { + imports = [ + ./servers/bashls.nix + ./servers/ltex.nix + ./servers/lua-ls.nix + ./servers/nil_ls.nix + ./servers/rust-analyzer.nix + ./servers/texlab.nix + ./servers/ccls.nix + ]; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/servers/servers/bashls.nix b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/bashls.nix new file mode 100644 index 00000000..0577a335 --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/bashls.nix @@ -0,0 +1,5 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + bashls.enable = true; + }; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/servers/servers/ccls.nix b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/ccls.nix new file mode 100644 index 00000000..0698bcce --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/ccls.nix @@ -0,0 +1,5 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + ccls.enable = true; + }; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/servers/servers/ltex.nix b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/ltex.nix new file mode 100644 index 00000000..0d039f82 --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/ltex.nix @@ -0,0 +1,39 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + ltex = let + filetypes = [ + "rust" + "java" + "cpp" + "shell" + "bash" + + "bibtex" + "context" + "context.tex" + "latex" + "tex" + + "html" + "markdown" + "org" + "restructuredtext" + "rsweave" + + "git-commit" + "gitcommit" + ]; + in { + enable = true; + inherit filetypes; + settings = { + enabled = filetypes; + completionEnabled = false; + language = "en-CA"; + additionalRules = { + enablePickyRules = true; + }; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/servers/servers/lua-ls.nix b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/lua-ls.nix new file mode 100644 index 00000000..5a44b500 --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/lua-ls.nix @@ -0,0 +1,8 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + lua-ls = { + enable = true; + settings.telemetry.enable = false; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/servers/servers/nil_ls.nix b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/nil_ls.nix new file mode 100644 index 00000000..f0cccbdc --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/nil_ls.nix @@ -0,0 +1,10 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + nil_ls = { + enable = true; + settings = { + formatting.command = ["alejandra"]; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/servers/servers/rust-analyzer.nix b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/rust-analyzer.nix new file mode 100644 index 00000000..943a8c80 --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/rust-analyzer.nix @@ -0,0 +1,10 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + rust-analyzer = { + enable = true; + settings = { + typing.autoClosingAngleBrackets.enable = true; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plgs/lsp/servers/servers/texlab.nix b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/texlab.nix new file mode 100644 index 00000000..59af8d39 --- /dev/null +++ b/hm/soispha/conf/nvim/plgs/lsp/servers/servers/texlab.nix @@ -0,0 +1,7 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + texlab = { + enable = true; + }; + }; +} |