diff options
Diffstat (limited to '.config')
-rw-r--r-- | .config/nvim/lua/general.lua | 6 | ||||
-rw-r--r-- | .config/nvim/lua/keybinds.lua | 18 | ||||
-rw-r--r-- | .config/nvim/lua/lsp.lua | 148 | ||||
-rw-r--r-- | .config/nvim/lua/plugins.lua | 47 | ||||
-rw-r--r-- | .config/nvim/lua/statusline.lua | 8 |
5 files changed, 132 insertions, 95 deletions
diff --git a/.config/nvim/lua/general.lua b/.config/nvim/lua/general.lua index 03f511a..ccf0ee3 100644 --- a/.config/nvim/lua/general.lua +++ b/.config/nvim/lua/general.lua @@ -53,6 +53,7 @@ vim.g.markdown_fenced_languages = { "tsx=typescriptreact"; "js=javascript"; "jsx=javascriptreact"; + "json"; "typescript"; "javascript"; "typescriptreact"; @@ -60,7 +61,9 @@ vim.g.markdown_fenced_languages = { "pwsh=ps1"; "powershell=ps1"; "ps1"; + "lua"; "xml"; + "html"; "mermaid"; "yaml"; "yml=yaml"; @@ -72,6 +75,8 @@ vim.g.markdown_fenced_languages = { "c"; "cpp"; "ini=toml"; + "diff"; + "git"; } if vim.fn.has("wsl") == 1 then @@ -88,4 +93,3 @@ else end; }) end - diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua index 800eaab..b0cab46 100644 --- a/.config/nvim/lua/keybinds.lua +++ b/.config/nvim/lua/keybinds.lua @@ -42,11 +42,19 @@ vim.keymap.set("n", "<Leader>t", ":belowright split | resize 5 | terminal<CR>") vim.keymap.set("n", "<Leader>[", ufo.openAllFolds) vim.keymap.set("n", "<Leader>]", ufo.closeAllFolds) vim.keymap.set("n", "<Leader>r", vim.lsp.buf.rename) +vim.keymap.set("n", "<Leader>N", ":bnext<CR>") +vim.keymap.set("n", "<Leader>P", ":bprevious<CR>") -vim.keymap.set({ "n"; "o"; "x" }, "W", function() spider.motion("w") end) -vim.keymap.set({ "n"; "o"; "x" }, "E", function() spider.motion("e") end) -vim.keymap.set({ "n"; "o"; "x" }, "B", function() spider.motion("b") end) -vim.keymap.set({ "n"; "o"; "x" }, "gE", function() spider.motion("ge") end) +local spider_opts = { skipInsignificantPunctuation = true } + +vim.keymap.set({ "n"; "o"; "x" }, "<A-w>", + function() spider.motion("w", spider_opts) end) +vim.keymap.set({ "n"; "o"; "x" }, "<A-e>", + function() spider.motion("e", spider_opts) end) +vim.keymap.set({ "n"; "o"; "x" }, "<A-b>", + function() spider.motion("b", spider_opts) end) +vim.keymap.set({ "n"; "o"; "x" }, "<A-g><A-e>", + function() spider.motion("ge", spider_opts) end) vim.keymap.set({ "t" }, "<ESC>", "<C-\\><C-n>") vim.opt.whichwrap = "<,>,h,l,[,]" @@ -74,4 +82,6 @@ wk.register({ ["R"] = "Show References"; ["J"] = "Signature help"; ["U"] = "Undo tree"; + ["N"] = "Next tab"; + ["P"] = "Previous tab"; }, { prefix = "<leader>" }); diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 07aeac2..2591a8b 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -1,6 +1,16 @@ --- Setup nvim-cmp. local cmp = require("cmp") +local lspconfig = require("lspconfig") +local cmplsp = require("cmp_nvim_lsp") +local lsp_inlayhints = require("lsp-inlayhints") +local lsp_signature = require("lsp_signature") +local dap = require("dap") +local dapui = require("dapui") +local omnisharp_extended = require("omnisharp_extended") +local deno_nvim = require("deno-nvim") +local lspkind = require("lspkind") +local cmp_types = require("cmp.types") +-- Setup nvim-cmp. cmp.setup({ snippet = { -- REQUIRED - you must specify a snippet engine @@ -23,23 +33,20 @@ cmp.setup({ { name = "nvim_lsp"; entry_filter = function(entry) - return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= - "Text" + return cmp_types.lsp.CompletionItemKind[entry:get_kind()] ~= "Text" end; }; { name = "vsnip"; entry_filter = function(entry) - return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= - "Text" + return cmp_types.lsp.CompletionItemKind[entry:get_kind()] ~= "Text" end; }; }, { { name = "buffer"; entry_filter = function(entry) - return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= - "Text" + return cmp_types.lsp.CompletionItemKind[entry:get_kind()] ~= "Text" end; }; }); @@ -65,7 +72,6 @@ cmp.setup.cmdline(":", { }) -- Setup lspconfig. -local cmplsp = require("cmp_nvim_lsp") local capabilities = vim.lsp.protocol.make_client_capabilities() cmplsp.default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- Enable (broadcasting) snippet capability for completion @@ -73,7 +79,7 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true cmp.setup({ formatting = { - format = require("lspkind").cmp_format({ + format = lspkind.cmp_format({ mode = "symbol"; -- show only symbol annotations maxwidth = 50; -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) @@ -87,10 +93,9 @@ cmp.setup({ local on_attach = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - local lsp_signature = require("lsp_signature") lsp_signature.on_attach({ bind = true }, bufnr) - require("lsp-inlayhints").setup() - require("lsp-inlayhints").on_attach(client, bufnr, false) + lsp_inlayhints.setup() + lsp_inlayhints.on_attach(client, bufnr, false) if client.server_capabilities.semanticTokensProvider then client.server_capabilities.semanticTokensProvider = nil end @@ -104,11 +109,10 @@ vim.api.nvim_create_autocmd("LspAttach", { local bufnr = args.buf local client = vim.lsp.get_client_by_id(args.data.client_id) - require("lsp-inlayhints").on_attach(client, bufnr, false) + lsp_inlayhints.on_attach(client, bufnr, false) end; }) -local lspconfig = require("lspconfig") local lsputils = lspconfig.util lspconfig.tsserver.setup({ @@ -140,26 +144,27 @@ lspconfig.tsserver.setup({ }; }) --- require("deno-nvim").setup({ --- server = { --- root_dir = vim.loop.cwd; --- capabilities = capabilities; --- on_attach = on_attach; --- settings = { --- deno = { --- unstable = true; --- inlayHints = { --- enumMemberValues = { enabled = true }; --- functionLikeReturnTypes = { enabled = true }; --- parameterNames = { enabled = "all" }; --- parameterTypes = { enabled = true }; --- propertyDeclarationTypes = { enabled = true }; --- variableTypes = { enabled = true; suppressWhenTypeMatchesName = false }; --- }; --- }; --- }; --- }; --- }); +deno_nvim.setup({ + server = { + -- Uncomment to allow all js/ts files, not just in a deno context + -- root_dir = vim.loop.cwd; + capabilities = capabilities; + on_attach = on_attach; + settings = { + deno = { + unstable = true; + inlayHints = { + enumMemberValues = { enabled = true }; + functionLikeReturnTypes = { enabled = true }; + parameterNames = { enabled = "all" }; + parameterTypes = { enabled = true }; + propertyDeclarationTypes = { enabled = true }; + variableTypes = { enabled = true; suppressWhenTypeMatchesName = false }; + }; + }; + }; + }; +}); lspconfig.rust_analyzer.setup({ capabilities = capabilities; @@ -169,9 +174,7 @@ lspconfig.rust_analyzer.setup({ lspconfig.omnisharp.setup({ cmd = { "omnisharp" }; - handlers = { - ["textDocument/definition"] = require("omnisharp_extended").handler; - }; + handlers = { ["textDocument/definition"] = omnisharp_extended.handler }; on_attach = on_attach; capabilities = capabilities; @@ -217,17 +220,18 @@ lspconfig.omnisharp.setup({ -- capabilities = capabilities; -- }) --- lspconfig.jsonls.setup({ --- capabilities = capabilities; --- cmd = { "vscode-json-language-server"; "--stdio" }; --- on_attach = on_attach; --- }) +lspconfig.jsonls.setup({ + capabilities = capabilities; + cmd = { "vscode-json-language-server"; "--stdio" }; + on_attach = on_attach; +}) --- lspconfig.html.setup({ --- capabilities = capabilities; --- cmd = { "vscode-html-language-server"; "--stdio" }; --- on_attach = on_attach; --- }) +lspconfig.html.setup({ + capabilities = capabilities; + cmd = { "vscode-html-language-server"; "--stdio" }; + on_attach = on_attach; + settings = { html = { format = { indentInnerHtml = true } } }; +}) -- lspconfig.cssls.setup({ capabilities = capabilities; on_attach = on_attach }) @@ -266,36 +270,38 @@ lspconfig.jdtls.setup({}) lspconfig.jedi_language_server.setup({}) -local null_ls = require("null-ls") - -null_ls.setup({ - sources = { - -- null_ls.builtins.diagnostics.eslint; - -- null_ls.builtins.formatting.eslint; - null_ls.builtins.formatting.lua_format; - -- null_ls.builtins.formatting.prettier; - null_ls.builtins.formatting.rustfmt; - -- null_ls.builtins.code_actions.shellcheck; - -- null_ls.builtins.completion.spell; - -- null_ls.builtins.diagnostics.tsc; - -- null_ls.builtins.formatting.deno_fmt; - -- null_ls.builtins.code_actions.gitsigns.with({ - -- config = { - -- filter_actions = function(title) - -- -- filter out blame actions - -- return title:lower():match("blame") == nil - -- end; - -- }; - -- }); - }; -}) +lspconfig.gopls.setup({}) + +-- Deprecated +-- local null_ls = require("null-ls") + +-- null_ls.setup({ +-- sources = { +-- -- null_ls.builtins.diagnostics.eslint; +-- -- null_ls.builtins.formatting.eslint; +-- null_ls.builtins.formatting.lua_format; +-- -- null_ls.builtins.formatting.prettier; +-- null_ls.builtins.formatting.rustfmt; +-- -- null_ls.builtins.code_actions.shellcheck; +-- -- null_ls.builtins.completion.spell; +-- -- null_ls.builtins.diagnostics.tsc; +-- -- null_ls.builtins.formatting.deno_fmt; +-- -- null_ls.builtins.code_actions.gitsigns.with({ +-- -- config = { +-- -- filter_actions = function(title) +-- -- -- filter out blame actions +-- -- return title:lower():match("blame") == nil +-- -- end; +-- -- }; +-- -- }); +-- }; +-- }) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded"; relative = "cursor" }) -- Debugging -local dap, dapui = require("dap"), require("dapui") dap.adapters.netcoredbg = { type = "executable"; command = "netcoredbg"; diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 8f274b0..711116a 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -69,7 +69,8 @@ local PKGS = { { url = "https://github.com/ray-x/lsp_signature.nvim.git" }; { url = "https://github.com/Hoffs/omnisharp-extended-lsp.nvim.git" }; { url = "https://github.com/lewis6991/gitsigns.nvim.git" }; - { url = "https://github.com/jose-elias-alvarez/null-ls.nvim.git" }; + -- Deprecated + -- { url = "https://github.com/jose-elias-alvarez/null-ls.nvim.git" }; { url = "https://github.com/mfussenegger/nvim-dap.git" }; { url = "https://github.com/rcarriga/nvim-dap-ui.git" }; { url = "https://github.com/antoinemadec/FixCursorHold.nvim.git" }; @@ -86,6 +87,21 @@ local PKGS = { local function init_plugins() local paq = require("paq") + local indent_blankline = require("indent_blankline") + local colorizer = require("colorizer") + local ufo = require("ufo") + local catppuccin = require("catppuccin") + local osc52 = require("osc52") + local devcontainer = require("devcontainer") + local whichkey = require("which-key") + local orgmode = require("orgmode") + local nvim_treesitter_config = require("nvim-treesitter.configs") + local mini_surround = require("mini.surround") + local mini_comment = require("mini.comment") + local gitsigns = require("gitsigns") + local marks = require("marks") + local neotest = require("neotest") + paq(PKGS) vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]] @@ -95,7 +111,7 @@ local function init_plugins() vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]] vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]] - require("indent_blankline").setup { + indent_blankline.setup { char_highlight_list = { "IndentBlanklineIndent1"; "IndentBlanklineIndent2"; @@ -110,7 +126,7 @@ local function init_plugins() show_current_context_start = true; } - require("colorizer").setup({ "*" }, { + colorizer.setup({ "*" }, { RGB = true; -- #RGB hex codes RRGGBB = true; -- #RRGGBB hex codes names = true; -- "Name" codes like Blue @@ -127,13 +143,13 @@ local function init_plugins() vim.g.minimap_highlight_range = 1 vim.g.minimap_highlight_search = 1 - require("ufo").setup({ + ufo.setup({ provider_selector = function(bufnr, filetype, buftype) return { "treesitter"; "indent" } end; }); - require("catppuccin").setup({ + catppuccin.setup({ transparent_background = true; show_end_of_line = true; term_colors = true; @@ -144,18 +160,17 @@ local function init_plugins() vim.o.foldlevelstart = 99 vim.o.foldenable = true - require("osc52").setup { + osc52.setup { max_length = 0; -- Maximum length of selection (0 for no limit) silent = false; -- Disable message on successful copy trim = false; -- Trim surrounding whitespaces before copy } - require("devcontainer").setup({}) - require("which-key").setup({}) + devcontainer.setup({ always_mount = {} }) + whichkey.setup({}) - local orgmode = require("orgmode") orgmode.setup_ts_grammar() - require("nvim-treesitter.configs").setup({ + nvim_treesitter_config.setup({ ensure_installed = { "javascript"; "typescript"; @@ -164,6 +179,8 @@ local function init_plugins() "jsonc"; "org"; }; + ignore_install = {}; + modules = {}; sync_install = false; auto_install = true; highlight = { @@ -174,8 +191,8 @@ local function init_plugins() }) orgmode.setup({ org_default_notes_file = "~/.cache/org/refile.org" }) - require("mini.surround").setup({}) - require("mini.comment").setup({ + mini_surround.setup({}) + mini_comment.setup({ -- Options which control module behavior options = { -- Whether to ignore blank lines @@ -202,7 +219,7 @@ local function init_plugins() }; }) - require("gitsigns").setup { + gitsigns.setup { signs = { add = { hl = "GitSignsAdd"; @@ -270,7 +287,7 @@ local function init_plugins() yadm = { enable = false }; } - require("marks").setup({ + marks.setup({ -- whether to map keybinds or not. default true default_mappings = false; -- which builtin marks to show. default {} @@ -294,7 +311,7 @@ local function init_plugins() mappings = {}; }) - require("neotest").setup({ adapters = { require("neotest-dotnet") } }) + neotest.setup({ adapters = { require("neotest-dotnet") } }) end local function clone_paq() diff --git a/.config/nvim/lua/statusline.lua b/.config/nvim/lua/statusline.lua index d5a7ad8..a09fda8 100644 --- a/.config/nvim/lua/statusline.lua +++ b/.config/nvim/lua/statusline.lua @@ -4,10 +4,10 @@ require("lualine").setup { options = { icons_enabled = true; theme = "auto"; - -- component_separators = { left = ""; right = "" }; - -- section_separators = { left = ""; right = "" }; - component_separators = { left = ""; right = "" }; - section_separators = { left = ""; right = "" }; + component_separators = { left = ""; right = "" }; + section_separators = { left = ""; right = "" }; + -- component_separators = { left = ""; right = "" }; + -- section_separators = { left = ""; right = "" }; disabled_filetypes = {}; always_divide_middle = true; globalstatus = false; |