aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorLuca Matei Pintilie <lucafulger@gmail.com>2022-09-17 20:40:08 +0000
committerLuca Matei Pintilie <lucafulger@gmail.com>2022-09-17 20:40:08 +0000
commite9dad4bb8cbe18416a30cc8cfb75e02246ecab71 (patch)
tree64f467c6ca485ee879f7200c657f7e1b6e09b0f4 /.config
parentc1fe9176c0c9609c7d76d1c014e48f58dcb65b38 (diff)
downloaddotfiles-e9dad4bb8cbe18416a30cc8cfb75e02246ecab71.tar
dotfiles-e9dad4bb8cbe18416a30cc8cfb75e02246ecab71.tar.gz
dotfiles-e9dad4bb8cbe18416a30cc8cfb75e02246ecab71.tar.bz2
dotfiles-e9dad4bb8cbe18416a30cc8cfb75e02246ecab71.tar.lz
dotfiles-e9dad4bb8cbe18416a30cc8cfb75e02246ecab71.tar.xz
dotfiles-e9dad4bb8cbe18416a30cc8cfb75e02246ecab71.tar.zst
dotfiles-e9dad4bb8cbe18416a30cc8cfb75e02246ecab71.zip
Add more lsp configs and keybinds
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/lua/keybinds.lua39
-rw-r--r--.config/nvim/lua/lsp.lua88
-rw-r--r--.config/nvim/lua/plugins.lua1
3 files changed, 113 insertions, 15 deletions
diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua
index c82587d..0846a1c 100644
--- a/.config/nvim/lua/keybinds.lua
+++ b/.config/nvim/lua/keybinds.lua
@@ -1,7 +1,8 @@
-vim.g.mapleader = " "
+local telescope = require('telescope.builtin')
+local wk = require("which-key")
+local nt_api = require("nvim-tree.api")
-vim.api.nvim_set_keymap("n", "<Leader>n", ":NvimTreeToggle<CR>",
- { noremap = true; silent = true })
+vim.g.mapleader = " "
vim.api.nvim_command("nnoremap <A-j> :m .+1<CR>==")
vim.api.nvim_command("nnoremap <A-k> :m .-2<CR>==")
@@ -10,14 +11,16 @@ vim.api.nvim_command("inoremap <A-j> <Esc>:m .+1<CR>==gi")
vim.api.nvim_command("vnoremap <A-j> :m '>+1<CR>gv=gv")
vim.api.nvim_command("vnoremap <A-k> :m '<-2<CR>gv=gv")
-vim.api.nvim_command(
- "nnoremap <buffer> <Leader><CR> :lua vim.lsp.buf.code_action()<CR>")
-vim.api.nvim_command("nnoremap <buffer> <Leader>, :TroubleToggle<CR>")
+vim.keymap.set("n", "<Leader>n", nt_api.tree.toggle)
+vim.keymap.set("n", "<Leader><CR>", vim.lsp.buf.code_action)
+vim.keymap.set("n", "<Leader>K", vim.lsp.buf.hover)
+vim.keymap.set("n", "<Leader>D", vim.lsp.buf.definition)
+vim.keymap.set("n", "<Leader>F", vim.lsp.buf.formatting)
-vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>",
- { noremap = true; silent = true })
-vim.api.nvim_set_keymap("n", "<Leader><TAB>", ":Telescope buffers<CR>",
- { noremap = true; silent = true })
+vim.keymap.set("n", "<Leader>f", telescope.find_files)
+vim.keymap.set("n", "<Leader><TAB>", telescope.buffers)
+
+vim.api.nvim_command("nnoremap <buffer> <Leader>, :TroubleToggle<CR>")
vim.keymap.set("n", "<Leader>[", require("ufo").openAllFolds)
vim.keymap.set("n", "<Leader>]", require("ufo").closeAllFolds)
@@ -25,3 +28,19 @@ vim.keymap.set("n", "<Leader>r", require("renamer").rename)
vim.opt.whichwrap = "<,>,h,l,[,]"
+wk.register({
+ ["<CR>"] = "Quick Action";
+ ["K"] = "Hover";
+ ["D"] = "Definition";
+ ["F"] = "Format";
+ ["f"] = "Find files";
+ ["<TAB>"] = "Show buffers";
+ [","] = "Show errors";
+ ["["] = "Open folds";
+ ["]"] = "Close folds";
+ ["r"] = "Rename";
+ ["n"] = "Show file tree";
+}, {
+ prefix = "<leader>";
+});
+
diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua
index 8f728f0..85da5ff 100644
--- a/.config/nvim/lua/lsp.lua
+++ b/.config/nvim/lua/lsp.lua
@@ -46,8 +46,8 @@ cmp.setup.cmdline(":", {
-- Setup lspconfig.
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp
- .protocol
- .make_client_capabilities())
+ .protocol
+ .make_client_capabilities())
require("lspconfig")["denols"].setup { capabilities = capabilities }
local lspkind = require("lspkind")
@@ -66,14 +66,92 @@ cmp.setup {
local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
end
+--Enable (broadcasting) snippet capability for completion
+local capabilities = vim.lsp.protocol.make_client_capabilities()
+capabilities.textDocument.completion.completionItem.snippetSupport = true
-require("lspconfig")["tsserver"].setup { on_attach = on_attach }
-require("lspconfig")["denols"].setup {
+local lsputils = require("lspconfig").util
+
+require("lspconfig").tsserver.setup({
+ on_attach = on_attach,
+ root_dir = lsputils.root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")
+})
+
+require("lspconfig").denols.setup {
on_attach = on_attach;
- init_options = { enable = true; unstable = true; config = "./deno.jsonc" };
+ init_options = {
+ enable = true;
+ unstable = true;
+ config = "./deno.jsonc";
+ };
root_dir = vim.loop.cwd;
}
+require('lspconfig').rust_analyzer.setup({})
+
+require('lspconfig').sqls.setup({
+ on_attach = function(client, bufnr)
+ require('sqls').on_attach(client, bufnr)
+ end
+})
+
+require'lspconfig'.omnisharp.setup {
+ cmd = { "omnisharp" },
+
+ -- Enables support for reading code style, naming convention and analyzer
+ -- settings from .editorconfig.
+ enable_editorconfig_support = true,
+
+ -- If true, MSBuild project system will only load projects for files that
+ -- were opened in the editor. This setting is useful for big C# codebases
+ -- and allows for faster initialization of code navigation features only
+ -- for projects that are relevant to code that is being edited. With this
+ -- setting enabled OmniSharp may load fewer projects and may thus display
+ -- incomplete reference lists for symbols.
+ enable_ms_build_load_projects_on_demand = false,
+
+ -- Enables support for roslyn analyzers, code fixes and rulesets.
+ enable_roslyn_analyzers = false,
+
+ -- Specifies whether 'using' directives should be grouped and sorted during
+ -- document formatting.
+ organize_imports_on_format = false,
+
+ -- Enables support for showing unimported types and unimported extension
+ -- methods in completion lists. When committed, the appropriate using
+ -- directive will be added at the top of the current file. This option can
+ -- have a negative impact on initial completion responsiveness,
+ -- particularly for the first few completion sessions after opening a
+ -- solution.
+ enable_import_completion = false,
+
+ -- Specifies whether to include preview versions of the .NET SDK when
+ -- determining which version to use for project loading.
+ sdk_include_prereleases = true,
+
+ -- Only run analyzers against open files when 'enableRoslynAnalyzers' is
+ -- true
+ analyze_open_documents_only = false,
+}
+
+require('lspconfig').marksman.setup({
+ root_dir = vim.loop.cwd;
+})
+
+require('lspconfig').jsonls.setup({
+ capabilities = capabilities,
+ cmd = { "vscode-json-languageserver", "--stdio" }
+})
+
+require('lspconfig').html.setup({
+ capabilities = capabilities,
+ cmd = { "vscode-html-languageserver", "--stdio" }
+})
+
+require('lspconfig').cssls.setup({
+ capabilities = capabilities,
+})
+
vim.diagnostic.config({
virtual_text = true;
signs = true;
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index e7e42db..217a098 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -53,6 +53,7 @@ local PKGS = {
{ url = "https://github.com/onsails/lspkind.nvim.git" };
{ url = "https://github.com/folke/trouble.nvim.git" };
{ url = "https://github.com/folke/lsp-colors.nvim.git" };
+ { url = "https://github.com/nanotee/sqls.nvim.git"};
-- Dev container
{ url = "https://codeberg.org/esensar/nvim-dev-container.git" };