diff options
Diffstat (limited to '.config')
| -rw-r--r-- | .config/nvim/TODO | 4 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/multicursor.lua | 61 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/oil.lua | 7 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/pair.lua (renamed from .config/nvim/lua/plugins/mini.lua) | 0 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/surround.lua | 21 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/trouble.lua | 5 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/zig.lua | 5 |
7 files changed, 84 insertions, 19 deletions
diff --git a/.config/nvim/TODO b/.config/nvim/TODO index 9970b95..bb924ac 100644 --- a/.config/nvim/TODO +++ b/.config/nvim/TODO @@ -1,2 +1,2 @@ -- yank doesn't move cursor pack -- multiple cursors +- save more than one yank (emacs killring like) +- undo chunks typed in insert mode diff --git a/.config/nvim/lua/plugins/multicursor.lua b/.config/nvim/lua/plugins/multicursor.lua new file mode 100644 index 0000000..75f8b6e --- /dev/null +++ b/.config/nvim/lua/plugins/multicursor.lua @@ -0,0 +1,61 @@ +return { + "jake-stewart/multicursor.nvim", + branch = "1.0", + config = function() + local mc = require("multicursor-nvim") + mc.setup() + + local set = vim.keymap.set + + -- Add or skip cursor above/below the main cursor. + set({"n", "x"}, "<up>", function() mc.lineAddCursor(-1) end) + set({"n", "x"}, "<down>", function() mc.lineAddCursor(1) end) + set({"n", "x"}, "<leader><up>", function() mc.lineSkipCursor(-1) end) + set({"n", "x"}, "<leader><down>", function() mc.lineSkipCursor(1) end) + + -- Add or skip adding a new cursor by matching word/selection + set({"n", "x"}, "<leader>n", function() mc.matchAddCursor(1) end) + set({"n", "x"}, "<leader>s", function() mc.matchSkipCursor(1) end) + set({"n", "x"}, "<leader>N", function() mc.matchAddCursor(-1) end) + set({"n", "x"}, "<leader>S", function() mc.matchSkipCursor(-1) end) + + -- Add and remove cursors with control + left click. + set("n", "<c-leftmouse>", mc.handleMouse) + set("n", "<c-leftdrag>", mc.handleMouseDrag) + set("n", "<c-leftrelease>", mc.handleMouseRelease) + + -- Disable and enable cursors. + set({"n", "x"}, "<c-q>", mc.toggleCursor) + + -- Mappings defined in a keymap layer only apply when there are + -- multiple cursors. This lets you have overlapping mappings. + mc.addKeymapLayer(function(layerSet) + + -- Select a different cursor as the main one. + layerSet({"n", "x"}, "<left>", mc.prevCursor) + layerSet({"n", "x"}, "<right>", mc.nextCursor) + + -- Delete the main cursor. + layerSet({"n", "x"}, "<leader>x", mc.deleteCursor) + + -- Enable and clear cursors using escape. + layerSet("n", "<esc>", function() + if not mc.cursorsEnabled() then + mc.enableCursors() + else + mc.clearCursors() + end + end) + 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 +} diff --git a/.config/nvim/lua/plugins/oil.lua b/.config/nvim/lua/plugins/oil.lua deleted file mode 100644 index 714a05f..0000000 --- a/.config/nvim/lua/plugins/oil.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - 'stevearc/oil.nvim', - ---@module 'oil' - opts = {}, - dependencies = { { "echasnovski/mini.icons", opts = {} } }, - lazy = false, -} diff --git a/.config/nvim/lua/plugins/mini.lua b/.config/nvim/lua/plugins/pair.lua index 5698563..5698563 100644 --- a/.config/nvim/lua/plugins/mini.lua +++ b/.config/nvim/lua/plugins/pair.lua diff --git a/.config/nvim/lua/plugins/surround.lua b/.config/nvim/lua/plugins/surround.lua new file mode 100644 index 0000000..ffe4bf3 --- /dev/null +++ b/.config/nvim/lua/plugins/surround.lua @@ -0,0 +1,21 @@ +return { + "echasnovski/mini.surround", + event = "VeryLazy", + config = function() + require("mini.surround").setup({ + mappings = { + add = 'ys', + delete = 'ds', + find = '', + find_left = '', + highlight = '', + replace = '', + update_n_lines = '', + + -- Add this only if you don't want to use extended mappings + suffix_last = '', + suffix_next = '', + } + }) + end +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua deleted file mode 100644 index 1e81a92..0000000 --- a/.config/nvim/lua/plugins/trouble.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "folke/trouble.nvim", - config = true, - cmd = "Trouble" -} diff --git a/.config/nvim/lua/plugins/zig.lua b/.config/nvim/lua/plugins/zig.lua deleted file mode 100644 index 394c450..0000000 --- a/.config/nvim/lua/plugins/zig.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "ziglang/zig.vim", - ft = "zig", -} - |
