summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock17
-rw-r--r--flake.nix36
-rw-r--r--lsp/angular-language-server.lua11
-rw-r--r--lsp/biome.lua14
-rw-r--r--lsp/lua-language-server.lua8
-rw-r--r--lsp/typescript-language-server.lua39
-rw-r--r--lua/config/lsp.lua25
-rw-r--r--lua/config/options.lua15
-rw-r--r--lua/config/plugins/completion.lua44
-rw-r--r--lua/config/plugins/debug.lua23
-rw-r--r--lua/config/plugins/extra.lua105
-rw-r--r--lua/config/plugins/formatting.lua11
-rw-r--r--lua/config/plugins/fuzzy.lua94
-rw-r--r--lua/config/plugins/init.lua1
-rw-r--r--lua/config/plugins/treesitter.lua8
-rw-r--r--lua/config/plugins/ui.lua12
16 files changed, 383 insertions, 80 deletions
diff --git a/flake.lock b/flake.lock
index 26fc91d..d83ab51 100644
--- a/flake.lock
+++ b/flake.lock
@@ -244,6 +244,22 @@
"type": "github"
}
},
+ "plugins-multicursor-nvim": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1746157028,
+ "narHash": "sha256-ZV4/QolvzaxV0SoPwO3Orf3HCJGD2+J15WKRUe0Hauw=",
+ "owner": "jake-stewart",
+ "repo": "multicursor.nvim",
+ "rev": "0e00ce4c272e3191b5e07cab36bd49aa32fca675",
+ "type": "github"
+ },
+ "original": {
+ "owner": "jake-stewart",
+ "repo": "multicursor.nvim",
+ "type": "github"
+ }
+ },
"plugins-telepath-nvim": {
"flake": false,
"locked": {
@@ -266,6 +282,7 @@
"nixCats": "nixCats",
"nixpkgs": "nixpkgs_2",
"plugins-leap-spooky-nvim": "plugins-leap-spooky-nvim",
+ "plugins-multicursor-nvim": "plugins-multicursor-nvim",
"plugins-telepath-nvim": "plugins-telepath-nvim"
}
},
diff --git a/flake.nix b/flake.nix
index 3ec4206..9f096a8 100644
--- a/flake.nix
+++ b/flake.nix
@@ -47,6 +47,11 @@
url = "github:rasulomaroff/telepath.nvim";
flake = false;
};
+
+ plugins-multicursor-nvim = {
+ url = "github:jake-stewart/multicursor.nvim";
+ flake = false;
+ };
};
# see :help nixCats.flake.outputs
@@ -150,6 +155,17 @@
# cargo
rust-analyzer
];
+
+ typescript = [
+ angular-language-server
+ biome
+ prettierd
+ typescript-language-server
+ ];
+
+ debug = [
+ lldb
+ ];
};
};
@@ -191,6 +207,10 @@
leap-spooky-nvim
telepath-nvim
];
+
+ extra = [
+ multicursor-nvim
+ ];
};
general = with pkgs.vimPlugins; {
@@ -207,11 +227,12 @@
treesitter = [
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
+ nvim-ts-autotag
];
completion = [ blink-cmp ];
# NOTE: On NeoVim 0.11+ nvim-lspconfig is not required due to native API
- lsp = [ ];
+ lsp = [ lazydev-nvim ];
mini = [
mini-ai
@@ -227,13 +248,24 @@
git = [ gitsigns-nvim ];
+ debug = [
+ nvim-dap
+ nvim-dap-ui
+ nvim-dap-virtual-text
+ ];
+
ui = [
bufferline-nvim
+ lualine-nvim
noice-nvim
todo-comments-nvim
];
- extra = [ which-key-nvim ];
+ extra = [
+ oil-nvim
+ yanky-nvim
+ which-key-nvim
+ ];
};
};
diff --git a/lsp/angular-language-server.lua b/lsp/angular-language-server.lua
new file mode 100644
index 0000000..63a61c6
--- /dev/null
+++ b/lsp/angular-language-server.lua
@@ -0,0 +1,11 @@
+return {
+ cmd = { "ngserver", "--stdio" },
+ root_markers = { "angular.json" },
+ filetypes = {
+ "html",
+ "htmlangular",
+ "typescript",
+ "typescriptreact",
+ "typescript.tsx",
+ },
+}
diff --git a/lsp/biome.lua b/lsp/biome.lua
new file mode 100644
index 0000000..b55de9d
--- /dev/null
+++ b/lsp/biome.lua
@@ -0,0 +1,14 @@
+return {
+ cmd = { "biome", "lsp-proxy" },
+ root_markers = { "package.json", "biome.json", "biome.jsonc" },
+ filetypes = {
+ "json",
+ "jsonc",
+ "javascript",
+ "javascriptreact",
+ "javascript.jsx",
+ "typescript",
+ "typescriptreact",
+ "typescript.tsx",
+ },
+}
diff --git a/lsp/lua-language-server.lua b/lsp/lua-language-server.lua
index 72a0847..ce0d902 100644
--- a/lsp/lua-language-server.lua
+++ b/lsp/lua-language-server.lua
@@ -1,6 +1,6 @@
return {
cmd = { "lua-language-server" },
- root_markers = { ".luarc.json" },
+ root_markers = { ".luarc.json", ".git" },
filetypes = { "lua" },
settings = {
@@ -13,6 +13,12 @@ return {
disable = { "missing-fields" },
},
telemetry = { enabled = false },
+
+ workspace = {
+ library = {
+ vim.env.VIMRUNTIME,
+ },
+ },
},
},
}
diff --git a/lsp/typescript-language-server.lua b/lsp/typescript-language-server.lua
new file mode 100644
index 0000000..41a3110
--- /dev/null
+++ b/lsp/typescript-language-server.lua
@@ -0,0 +1,39 @@
+return {
+ cmd = { "typescript-language-server", "--stdio" },
+ root_markers = { "package.json", "jsconfig.json", "tsconfig.json" },
+ filetypes = {
+ "javascript",
+ "javascriptreact",
+ "javascript.jsx",
+ "typescript",
+ "typescriptreact",
+ "typescript.tsx",
+ },
+ settings = {
+ typescript = {
+ inlayHints = {
+ includeInlayParameterNameHints = "all",
+ includeInlayParameterNameHintsWhenArgumentMatchesName = true,
+ includeInlayVariableTypeHints = true,
+ includeInlayFunctionParameterTypeHints = true,
+ includeInlayVariableTypeHintsWhenTypeMatchesName = true,
+ includeInlayPropertyDeclarationTypeHints = true,
+ includeInlayFunctionLikeReturnTypeHints = true,
+ includeInlayEnumMemberValueHints = true,
+ },
+ },
+ javascript = {
+ inlayHints = {
+ includeInlayParameterNameHints = "all",
+ includeInlayParameterNameHintsWhenArgumentMatchesName = true,
+ includeInlayVariableTypeHints = true,
+
+ includeInlayFunctionParameterTypeHints = true,
+ includeInlayVariableTypeHintsWhenTypeMatchesName = true,
+ includeInlayPropertyDeclarationTypeHints = true,
+ includeInlayFunctionLikeReturnTypeHints = true,
+ includeInlayEnumMemberValueHints = true,
+ },
+ },
+ },
+}
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua
index a5bf027..413e06f 100644
--- a/lua/config/lsp.lua
+++ b/lua/config/lsp.lua
@@ -5,6 +5,25 @@ vim.diagnostic.config({
virtual_text = true,
})
-vim.lsp.enable("lua-language-server")
-vim.lsp.enable("nixd")
-vim.lsp.enable("rust-analyzer")
+vim.lsp.enable({
+ "lua-language-server",
+
+ "nixd",
+
+ "rust-analyzer",
+
+ "angular-language-server",
+ "biome",
+ "typescript-language-server",
+})
+
+vim.lsp.inlay_hint.enable(true)
+
+-- Enable Angular HTML Treesitter grammar when needed
+vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
+ pattern = { "*.component.html", "*.container.html" },
+ callback = function()
+ vim.bo.filetype = "htmlangular"
+ vim.treesitter.start(nil, "angular")
+ end,
+})
diff --git a/lua/config/options.lua b/lua/config/options.lua
index 1cacdeb..6208be7 100644
--- a/lua/config/options.lua
+++ b/lua/config/options.lua
@@ -18,6 +18,9 @@ if os.getenv("WAYLAND_DISPLAY") and vim.fn.exepath("wl-copy") ~= "" then
}
end
+-- Disable deprecation warnings
+vim.deprecate = function(_) end
+
-- Terminal colors
vim.opt.termguicolors = true
@@ -56,3 +59,15 @@ map("n", "N", "Nzzzv", { desc = "Previous Search Result" })
-- Reset search highlight on ESC
map("n", "<Esc>", "<cmd>nohlsearch<CR>", { desc = "Reset search highlight" })
+
+-- Window related binds
+map("n", "<C-w>d", "<C-w>c", { desc = "[D]elete [W]indow" })
+
+-- Buffer related binds
+map("n", "<leader>bd", "<cmd>bdelete<CR>", { desc = "[D]elete [B]uffer" })
+
+-- Tab related binds
+map("n", "[T", "<cmd>tabprev<CR>", { desc = "Previous Tab" })
+map("n", "]T", "<cmd>tabnext<CR>", { desc = "Previous Tab" })
+map("n", "<leader><tab>d", "<cmd>tabclose<CR>", { desc = "[D]elete [T]ab" })
+map("n", "<leader><tab>n", "<cmd>tabnew<CR>", { desc = "[N]ew [T]ab" })
diff --git a/lua/config/plugins/completion.lua b/lua/config/plugins/completion.lua
index 7a02809..2b7e69d 100644
--- a/lua/config/plugins/completion.lua
+++ b/lua/config/plugins/completion.lua
@@ -1,5 +1,32 @@
return {
{
+ "lazydev.nvim",
+ -- NOTE: if lazyloaded, blink will break as `lze` doesn't packadd this package...
+ -- ft = "lua",
+ after = function(_)
+ -- NOTE: this is required to fix strange filtering in `lazydev.nvim`
+ --- @diagnostic disable-next-line: duplicate-set-field
+ require("lazydev.lsp").supports = function(client)
+ local client_names = {
+ -- Default client names from `lazydev.nvim`
+ "lua_ls",
+ "emmylua-analyzer-rust",
+ -- NOTE: I have `lua-language-server` name which was not in list
+ "lua-language-server",
+ }
+
+ return client and vim.tbl_contains(client_names, client.name)
+ end
+
+ require("lazydev").setup({
+ library = {
+ { path = "${3rd}/luv/library", words = { "vim%.uv" } },
+ { path = "snacks.nvim", words = { "Snacks" } },
+ },
+ })
+ end,
+ },
+ {
"blink.cmp",
event = "DeferredUIEnter",
after = function(_)
@@ -18,7 +45,22 @@ return {
ghost_text = { enabled = true },
},
- sources = { default = { "lsp", "path", "snippets", "buffer" } },
+ cmdline = {
+ completion = {
+ ghost_text = { enabled = false },
+ },
+ },
+
+ sources = {
+ default = { "lazydev", "lsp", "path", "snippets", "buffer" },
+ providers = {
+ lazydev = {
+ name = "LazyDev",
+ module = "lazydev.integrations.blink",
+ score_offset = 100,
+ },
+ },
+ },
fuzzy = {
sorts = { "exact", "score", "sort_text" },
diff --git a/lua/config/plugins/debug.lua b/lua/config/plugins/debug.lua
new file mode 100644
index 0000000..0f6378b
--- /dev/null
+++ b/lua/config/plugins/debug.lua
@@ -0,0 +1,23 @@
+return {
+ {
+ "nvim-dap",
+ event = "DeferredUIEnter",
+ load = function(name)
+ vim.cmd.packadd(name)
+ vim.cmd.packadd("nvim-dap-ui")
+ vim.cmd.packadd("nvim-dap-virtual-text")
+ end,
+ after = function(_)
+ -- require("dap").setup()
+ require("dapui").setup()
+ require("nvim-dap-virtual-text").setup({})
+
+ local dap = require("dap")
+ dap.adapters.lldb = {
+ type = "executable",
+ command = "lldb-dap",
+ name = "lldb",
+ }
+ end,
+ },
+}
diff --git a/lua/config/plugins/extra.lua b/lua/config/plugins/extra.lua
index aba060b..2f7bf9c 100644
--- a/lua/config/plugins/extra.lua
+++ b/lua/config/plugins/extra.lua
@@ -1,11 +1,105 @@
return {
{
+ "multicursor-nvim",
+ event = "DeferredUIEnter",
+ after = function(_)
+ local mc = require("multicursor-nvim")
+ mc.setup({
+ signs = false,
+ })
+
+ -- Keybindings would be a lot better as <localleader>
+ local map = vim.keymap.set
+
+ -- NOTE: this required for "repeatable" commands
+ -- I'd like to use `2<localleader>cn` for example (and that doesn't work out of box)
+ local map_rep = function(modes, bind, action)
+ map(modes, bind, function()
+ for _ = 1, vim.v.count1, 1 do
+ action()
+ end
+ end)
+ end
+
+ -- stylua: ignore start
+ map({ "n", "x" }, "<localleader><localleader>", function() mc.clearCursors() end)
+ map({ "n", "x" }, "<localleader>R", function() mc.restoreCursors() end)
+
+ map_rep({ "n", "x" }, "<localleader>j", function() mc.lineAddCursor(1) end)
+ map_rep({ "n", "x" }, "<localleader>k", function() mc.lineAddCursor(-1) end)
+ map_rep({ "n", "x" }, "<localleader>J", function() mc.lineSkipCursor(1) end)
+ map_rep({ "n", "x" }, "<localleader>K", function() mc.lineSkipCursor(-1) end)
+
+ map_rep({ "n", "x" }, "<localleader>cn", function() mc.matchAddCursor(1) end)
+ map_rep({ "n", "x" }, "<localleader>cN", function() mc.matchAddCursor(-1) end)
+ map_rep({ "n", "x" }, "<localleader>cs", function() mc.matchSkipCursor(1) end)
+ map_rep({ "n", "x" }, "<localleader>cS", function() mc.matchSkipCursor(-1) end)
+ map({ "n", "x" }, "<localleader>cM", mc.matchAllAddCursors)
+ map("x", "<localleader>m", mc.matchCursors)
+ map("x", "<localleader>s", mc.splitCursors)
+
+ -- map("n", "<localleader>g", mc.addCursorOperator)
+ map({ "n", "x" }, "<localleader>g", mc.operator)
+ -- stylua: ignore end
+
+ -- Customize how cursors look.
+ local hl = vim.api.nvim_set_hl
+ hl(0, "MultiCursorCursor", { reverse = true })
+ hl(0, "MultiCursorVisual", { link = "Visual" })
+ hl(0, "MultiCursorSign", { link = "SignColumn" })
+ hl(0, "MultiCursorMatchPreview", { link = "Search" })
+ hl(0, "MultiCursorDisabledCursor", { reverse = true })
+ hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
+ hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
+ end,
+ },
+ {
+ "yanky.nvim",
+ event = "DeferredUIEnter",
+ after = function(_)
+ require("yanky").setup({
+ highlight = { timer = 150 },
+ system_clipboard = {
+ sync_with_ring = true,
+ },
+ })
+ end,
+ keys = {
+ { "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" },
+ { "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Text After Cursor" },
+ { "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Cursor" },
+ { "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Text After Selection" },
+ { "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Selection" },
+ { "[y", "<Plug>(YankyCycleForward)", desc = "Cycle Forward Through Yank History" },
+ { "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" },
+ { "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" },
+ { "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" },
+ { "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" },
+ { "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" },
+ { ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" },
+ { "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" },
+ { ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" },
+ { "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" },
+ { "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put After Applying a Filter" },
+ { "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" },
+ },
+ },
+ {
"which-key.nvim",
event = "DeferredUIEnter",
after = function(_)
require("which-key").setup()
require("which-key").add({
+ {
+ "<leader>w",
+ group = "windows",
+ proxy = "<C-w>",
+ expand = function()
+ return require("which-key.extras").expand.win()
+ end,
+ },
+
{ "<leader>s", group = "search" },
{
@@ -17,4 +111,15 @@ return {
})
end,
},
+ {
+ "oil.nvim",
+ -- NOTE: lazy loading is not recommended
+ event = "DeferredUIEnter",
+ after = function(_)
+ require("oil").setup()
+ end,
+ keys = {
+ { "-", "<CMD>Oil<CR>", { desc = "Open parent directory" } },
+ },
+ },
}
diff --git a/lua/config/plugins/formatting.lua b/lua/config/plugins/formatting.lua
index 9563905..98bbe06 100644
--- a/lua/config/plugins/formatting.lua
+++ b/lua/config/plugins/formatting.lua
@@ -10,6 +10,17 @@ return {
lua = { "stylua" },
nix = { "nixfmt" },
rust = { "rustfmt", lsp_format = "fallback" },
+
+ html = { "prettierd" },
+ htmlangular = { "prettierd" },
+ json = { "biome" },
+ jsonc = { "biome" },
+ javascript = { "biome" },
+ javascriptreact = { "biome" },
+ ["javascript.jsx"] = { "biome" },
+ typescript = { "biome" },
+ typescriptreact = { "biome" },
+ ["typescript.jsx"] = { "biome" },
},
})
diff --git a/lua/config/plugins/fuzzy.lua b/lua/config/plugins/fuzzy.lua
index fb3cd60..95bb108 100644
--- a/lua/config/plugins/fuzzy.lua
+++ b/lua/config/plugins/fuzzy.lua
@@ -14,87 +14,35 @@ return {
"fzf-lua",
event = "DeferredUIEnter",
after = function(_)
- require("fzf-lua").setup()
+ require("fzf-lua").setup({
+ keymap = {
+ fzf = {
+ ["tab"] = "down",
+ ["shift-tab"] = "up",
+ ["ctrl-q"] = "select-all+accept",
+ },
+ },
+ })
end,
keys = {
-- General
- {
- "<leader><leader>",
- function()
- require("fzf-lua").files()
- end,
- mode = { "n" },
- desc = "Search Files",
- },
- {
- "<leader><localleader>",
- function()
- require("fzf-lua").buffers()
- end,
- mode = { "n" },
- desc = "Search Buffers",
- },
- {
- "<leader>/",
- function()
- require("fzf-lua").live_grep()
- end,
- mode = { "n" },
- desc = "Search Grep",
- },
- {
- "<leader>:",
- function()
- require("fzf-lua").command_history()
- end,
- mode = { "n" },
- desc = "Command History",
- },
+ -- stylua: ignore start
+ { "<leader><leader>", function() require("fzf-lua").files() end, mode = { "n" }, desc = "Search Files", },
+ { "<leader><localleader>", function() require("fzf-lua").buffers() end, mode = { "n" }, desc = "Search Buffers", },
+ { "<leader>/", function() require("fzf-lua").live_grep() end, mode = { "n" }, desc = "Search Grep", },
+ { "<leader>:", function() require("fzf-lua").command_history() end, mode = { "n" }, desc = "Command History", },
-- Search
- {
- "<leader>sR",
- function()
- require("fzf-lua").resume()
- end,
- mode = { "n" },
- desc = "[R]esume [S]earch",
- },
- {
- "<leader>sb",
- function()
- require("fzf-lua").buffers()
- end,
- mode = { "n" },
- desc = "[S]earch [B]uffers",
- },
- {
- "<leader>sf",
- function()
- require("fzf-lua").files()
- end,
- mode = { "n" },
- desc = "[S]earch [F]iles",
- },
- {
- "<leader>sg",
- function()
- require("fzf-lua").live_grep()
- end,
- mode = { "n" },
- desc = "[S]earch [G]rep",
- },
+ { "<leader>sR", function() require("fzf-lua").resume() end, mode = { "n" }, desc = "[R]esume [S]earch", },
+ { "<leader>sb", function() require("fzf-lua").buffers() end, mode = { "n" }, desc = "[S]earch [B]uffers", },
+ { "<leader>sf", function() require("fzf-lua").files() end, mode = { "n" }, desc = "[S]earch [F]iles", },
+ { "<leader>sg", function() require("fzf-lua").live_grep() end, mode = { "n" }, desc = "[S]earch [G]rep", },
+ { "<leader>sh", function() require("fzf-lua").helptags() end, mode = { "n" }, desc = "[S]earch [G]rep", },
-- Code
- {
- "<leader>ca",
- function()
- require("fzf-lua").lsp_code_actions()
- end,
- mode = { "n" },
- desc = "[C]ode [A]ctions",
- },
+ { "<leader>ca", function() require("fzf-lua").lsp_code_actions() end, mode = { "n" }, desc = "[C]ode [A]ctions", },
+ -- stylua: ignore end
},
},
}
diff --git a/lua/config/plugins/init.lua b/lua/config/plugins/init.lua
index 1ec4b50..f7c44fd 100644
--- a/lua/config/plugins/init.lua
+++ b/lua/config/plugins/init.lua
@@ -56,5 +56,6 @@ require("lze").load({
{ import = "config.plugins.completion" },
{ import = "config.plugins.formatting" },
{ import = "config.plugins.git" },
+ { import = "config.plugins.debug" },
{ import = "config.plugins.extra" },
})
diff --git a/lua/config/plugins/treesitter.lua b/lua/config/plugins/treesitter.lua
index 931a474..63bf48d 100644
--- a/lua/config/plugins/treesitter.lua
+++ b/lua/config/plugins/treesitter.lua
@@ -2,6 +2,7 @@ return {
{
"nvim-treesitter",
event = "DeferredUIEnter",
+ dep_of = { "nvim-ts-autotag" },
load = function(name)
vim.cmd.packadd(name)
vim.cmd.packadd("nvim-treesitter-textobjects")
@@ -13,4 +14,11 @@ return {
})
end,
},
+ {
+ "nvim-ts-autotag",
+ event = { "BufReadPre", "BufNewFile" },
+ after = function(_)
+ require("nvim-ts-autotag").setup()
+ end,
+ },
}
diff --git a/lua/config/plugins/ui.lua b/lua/config/plugins/ui.lua
index 19da163..e552f0e 100644
--- a/lua/config/plugins/ui.lua
+++ b/lua/config/plugins/ui.lua
@@ -10,6 +10,18 @@ return {
},
{
+ "lualine.nvim",
+ event = "DeferredUIEnter",
+ after = function(_)
+ require("lualine").setup({
+ options = {
+ theme = "catppuccin",
+ },
+ })
+ end,
+ },
+
+ {
"noice.nvim",
event = "DeferredUIEnter",
after = function(_)