diff options
Diffstat (limited to 'lua/config/plugins')
-rw-r--r-- | lua/config/plugins/completion.lua | 49 | ||||
-rw-r--r-- | lua/config/plugins/debug.lua | 23 | ||||
-rw-r--r-- | lua/config/plugins/extra.lua | 118 | ||||
-rw-r--r-- | lua/config/plugins/formatting.lua | 11 | ||||
-rw-r--r-- | lua/config/plugins/fuzzy.lua | 48 | ||||
-rw-r--r-- | lua/config/plugins/init.lua | 3 | ||||
-rw-r--r-- | lua/config/plugins/mini.lua | 31 | ||||
-rw-r--r-- | lua/config/plugins/telescope.lua | 28 | ||||
-rw-r--r-- | lua/config/plugins/treesitter.lua | 8 | ||||
-rw-r--r-- | lua/config/plugins/ui.lua | 34 |
10 files changed, 295 insertions, 58 deletions
diff --git a/lua/config/plugins/completion.lua b/lua/config/plugins/completion.lua index 0bcf7ad..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,14 +45,32 @@ 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" }, }, keymap = { - ["<S-space>"] = { "show", "show_documentation", "hide_documentation" }, + -- TODO: come up with more convenient keybinding + -- ["<S-space>"] = { "show", "show_documentation", "hide_documentation" }, + + ["<M-->"] = { "show", "show_documentation", "hide_documentation" }, ["<C-e>"] = { "hide", "fallback" }, ["<CR>"] = { "accept", "fallback" }, 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 6b2a029..2f7bf9c 100644 --- a/lua/config/plugins/extra.lua +++ b/lua/config/plugins/extra.lua @@ -1,29 +1,89 @@ return { { - "smart-splits.nvim", + "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 - map("n", "<M-h>", require("smart-splits").move_cursor_left) - map("n", "<M-j>", require("smart-splits").move_cursor_down) - map("n", "<M-k>", require("smart-splits").move_cursor_up) - map("n", "<M-l>", require("smart-splits").move_cursor_right) - map("n", "<M-Left>", require("smart-splits").move_cursor_left) - map("n", "<M-Down>", require("smart-splits").move_cursor_down) - map("n", "<M-Up>", require("smart-splits").move_cursor_up) - map("n", "<M-Right>", require("smart-splits").move_cursor_right) - - map("n", "<M-S-h>", require("smart-splits").resize_left) - map("n", "<M-S-j>", require("smart-splits").resize_down) - map("n", "<M-S-k>", require("smart-splits").resize_up) - map("n", "<M-S-l>", require("smart-splits").resize_right) - map("n", "<M-S-Left>", require("smart-splits").resize_left) - map("n", "<M-S-Down>", require("smart-splits").resize_down) - map("n", "<M-S-Up>", require("smart-splits").resize_up) - map("n", "<M-S-Right>", require("smart-splits").resize_right) + -- 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", @@ -31,6 +91,15 @@ return { 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" }, { @@ -42,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 new file mode 100644 index 0000000..95bb108 --- /dev/null +++ b/lua/config/plugins/fuzzy.lua @@ -0,0 +1,48 @@ +return { + -- NOTE: I left Telescope for compatibility purposes, in case if I need it one day + -- Everything is built on top of `fzf-lua` now + { + "telescope.nvim", + cmd = "Telescope", + after = function(_) + require("telescope").setup({}) + require("telescope").load_extension("notify") + end, + }, + + { + "fzf-lua", + event = "DeferredUIEnter", + after = function(_) + require("fzf-lua").setup({ + keymap = { + fzf = { + ["tab"] = "down", + ["shift-tab"] = "up", + ["ctrl-q"] = "select-all+accept", + }, + }, + }) + end, + + keys = { + -- General + -- 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>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", }, + -- stylua: ignore end + }, + }, +} diff --git a/lua/config/plugins/init.lua b/lua/config/plugins/init.lua index 4eb8b69..f7c44fd 100644 --- a/lua/config/plugins/init.lua +++ b/lua/config/plugins/init.lua @@ -50,11 +50,12 @@ require("lze").load({ { import = "config.plugins.ui" }, { import = "config.plugins.leap" }, - { import = "config.plugins.telescope" }, + { import = "config.plugins.fuzzy" }, { import = "config.plugins.treesitter" }, { import = "config.plugins.mini" }, { 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/mini.lua b/lua/config/plugins/mini.lua index 9160744..b5b757d 100644 --- a/lua/config/plugins/mini.lua +++ b/lua/config/plugins/mini.lua @@ -49,21 +49,38 @@ return { }) end, }, - -- NOTE: keybindings are intersecting with smart-splits.nvim - -- In the future I will fix it - -- + { + "mini.move", + event = "DeferredUIEnter", + after = function(_) + require("mini.move").setup({ + mappings = { + line_left = "<C-h>", + line_down = "<C-j>", + line_up = "<C-k>", + line_right = "<C-l>", + + left = "<C-h>", + down = "<C-j>", + up = "<C-k>", + right = "<C-l>", + }, + }) + end, + }, + -- NOTE: I don't like mini.pairs behaviour, so trying to change it -- { - -- "mini.move", + -- "mini.pairs", -- event = "DeferredUIEnter", -- after = function(_) - -- require("mini.move").setup() + -- require("mini.pairs").setup() -- end, -- }, { - "mini.pairs", + "nvim-autopairs", event = "DeferredUIEnter", after = function(_) - require("mini.pairs").setup() + require("nvim-autopairs").setup() end, }, { diff --git a/lua/config/plugins/telescope.lua b/lua/config/plugins/telescope.lua deleted file mode 100644 index d72d5fa..0000000 --- a/lua/config/plugins/telescope.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - { - "telescope.nvim", - cmd = "Telescope", - keys = { - { - "<leader><leader>", - function() - require("telescope.builtin").find_files() - end, - mode = { "n" }, - desc = "Search Files", - }, - { - "<leader>sf", - function() - require("telescope.builtin").find_files() - end, - mode = { "n" }, - desc = "[S]earch [F]iles", - }, - }, - after = function(_) - require("telescope").setup({}) - require("telescope").load_extension("notify") - end, - }, -} 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 12d0656..e552f0e 100644 --- a/lua/config/plugins/ui.lua +++ b/lua/config/plugins/ui.lua @@ -1,9 +1,41 @@ return { { + "bufferline.nvim", + event = "DeferredUIEnter", + after = function(_) + require("bufferline").setup({ + highlights = require("catppuccin.groups.integrations.bufferline").get(), + }) + end, + }, + + { + "lualine.nvim", + event = "DeferredUIEnter", + after = function(_) + require("lualine").setup({ + options = { + theme = "catppuccin", + }, + }) + end, + }, + + { "noice.nvim", event = "DeferredUIEnter", after = function(_) - require("noice").setup() + require("noice").setup({ + routes = { + { + filter = { + event = "msg_show", + find = "%d+L, %d+B", + }, + view = "mini", + }, + }, + }) end, }, |