From f60dd72912adda027d277137bb522d43ef6c2dc4 Mon Sep 17 00:00:00 2001 From: Michael Chalupiak Date: Fri, 19 Dec 2025 14:25:00 -0500 Subject: [PATCH 1/2] Small vim config changes --- config/.bashrc | 4 +-- config/.config/kak-tree-sitter/config.toml | 16 +++++----- config/.config/kak/kakrc | 35 +--------------------- config/.config/nvim/lua/config/keymap.lua | 4 +-- config/.config/nvim/lua/plugins/lsp.lua | 3 ++ config/.gitconfig | 2 +- config/.scripts/rfv.sh | 2 +- 7 files changed, 18 insertions(+), 48 deletions(-) diff --git a/config/.bashrc b/config/.bashrc index ac0abd6..9ed9b91 100644 --- a/config/.bashrc +++ b/config/.bashrc @@ -140,8 +140,8 @@ alias zf='z $(flirt)' # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -z "$EDITOR" ]; then - export EDITOR=kak -# export EDITOR='nvim' + # export EDITOR=kak + export EDITOR='nvim' fi if [ -f ~/.bash_aliases ]; then diff --git a/config/.config/kak-tree-sitter/config.toml b/config/.config/kak-tree-sitter/config.toml index 6d58e36..d16fe30 100644 --- a/config/.config/kak-tree-sitter/config.toml +++ b/config/.config/kak-tree-sitter/config.toml @@ -1,9 +1,9 @@ # lua -[language.lua.grammar.source.git] +[lua.grammar.source.git] url = "https://github.com/tree-sitter-grammars/tree-sitter-lua" pin = "88e446476a1e97a8724dff7a23e2d709855077f2" -[language.lua.grammar] +[lua.grammar] path = "src" compile = "cc" compile_args = ["-c", "-fpic", "../scanner.c", "../parser.c", "-I", ".."] @@ -44,11 +44,11 @@ path = "runtime/queries/lua" # path = "runtime/queries/clojure" #ocaml -[language.ocaml.grammar.source.git] +[ocaml.grammar.source.git] url = "https://github.com/tree-sitter/tree-sitter-ocaml" pin = "ef6ed4a773a260545f0b03c43d2ca78235e9a488" -[language.ocaml.grammar] +[ocaml.grammar] path = "grammars/ocaml/src" compile = "cc" compile_args = ["-c", "-fpic", "../scanner.c", "../parser.c", "-I", ".."] @@ -65,11 +65,11 @@ pin = "6bedca80646ce7350fb73029adf802ce7d9e241d" path = "runtime/queries/ocaml" # typst -[language.typst.grammar.source.git] +[typst.grammar.source.git] url = "https://github.com/uben0/tree-sitter-typst" pin = "46cf4ded12ee974a70bf8457263b67ad7ee0379d" -[language.typst.grammar] +[typst.grammar] path = "src" compile = "cc" compile_args = ["-c", "-fpic", "../scanner.c", "../parser.c", "-I", ".."] @@ -86,11 +86,11 @@ pin = "46cf4ded12ee974a70bf8457263b67ad7ee0379d" path = "queries/typst" # swift -[language.swift.grammar.source.git] +[swift.grammar.source.git] url = "https://github.com/alex-pinkus/tree-sitter-swift" pin = "57c1c6d6ffa1c44b330182d41717e6fe37430704" -[language.swift.grammar] +[swift.grammar] path = "src" compile = "cc" compile_args = ["-c", "-fpic", "../scanner.c", "-I", ".."] diff --git a/config/.config/kak/kakrc b/config/.config/kak/kakrc index 8fb0b33..b5f1409 100644 --- a/config/.config/kak/kakrc +++ b/config/.config/kak/kakrc @@ -112,39 +112,6 @@ add-highlighter global/ wrap -word -indent # } # } -# hook global -group autofmt BufSetOption filetype=(javascript) %{ -# set-option buffer formatcmd 'prettier --tab-width 4 --parser typescript' -# -# hook -group autofmt buffer BufOpenFile .* %{ -# format -# } -# -# hook -group autofmt buffer BufWritePre .* %{ -# format -# } -# } -# -# hook global -group autofmt BufSetOption filetype=(go) %{ -# set-option buffer formatcmd 'gofmt' -# -# hook -group autofmt buffer BufOpenFile .* %{ -# format -# } -# -# hook -group autofmt buffer BufWritePre .* %{ -# format -# } -# } -# } -# -# define-command disable-autofmt -docstring 'disable autoformatting of buffer' %{ -# remove-hooks global autofmt -# } -# -# enable-autofmt -# -# -# ## Indentation ## set global tabstop 4 set global indentwidth 4 @@ -453,7 +420,7 @@ define-command -docstring 'paste from clipboard' xpaste %{ declare-user-mode config map -docstring 'enter config mode' global user e ':enter-user-mode config' -map -docstring 'edit kakoune config' global config k ':cd ~/.config/kak/:e ./kakrc' +map -docstring 'edit kakoune config' global config k ':e ~/.config/kak/kakrc' map -docstring 'edit tmux config' global config t ':e ~/.tmux.conf' map -docstring 'edit bash config' global config b ':e ~/.bashrc' map -docstring 'edit scripts folder' global config s ':cd ~/.scripts:fzf-edit' diff --git a/config/.config/nvim/lua/config/keymap.lua b/config/.config/nvim/lua/config/keymap.lua index aa4b7a6..765d02f 100644 --- a/config/.config/nvim/lua/config/keymap.lua +++ b/config/.config/nvim/lua/config/keymap.lua @@ -5,7 +5,7 @@ end setnx('ff', Snacks.picker.files, 'Find files') setnx('f/', Snacks.picker.grep_word, 'Search current word') -setnx('f?', Snacks.picker.grep, 'Search in files') +setnx('fg', Snacks.picker.grep, 'Search in files') setnx('fr', Snacks.picker.recent, 'Find recent files') setnx('b', Snacks.picker.buffers, 'List buffers') setnx('h', Snacks.picker.help, 'Search help') @@ -42,7 +42,7 @@ setnx('`', '\'', 'Goto mark without column') setnx('x', 'bd!', 'Close Current Buffer') -setnx('grR', Snacks.picker.lsp_references, 'Search lsp references') +setnx('grr', Snacks.picker.lsp_references, 'Search lsp references') -- setnx('grI', tele.lsp_incoming_calls, 'Find incoming function calls') -- setnx('grO', tele.lsp_outgoing_calls, 'Find outgoing function calls') setnx('grd', Snacks.picker.diagnostics, 'Show LSP diagnostics') diff --git a/config/.config/nvim/lua/plugins/lsp.lua b/config/.config/nvim/lua/plugins/lsp.lua index ba530f3..4a1a089 100644 --- a/config/.config/nvim/lua/plugins/lsp.lua +++ b/config/.config/nvim/lua/plugins/lsp.lua @@ -71,6 +71,9 @@ return { }, -- (Default) Only show the documentation popup when manually triggered completion = { + trigger = { + show_on_insert = true + }, documentation = { auto_show = false }, list = { selection = { diff --git a/config/.gitconfig b/config/.gitconfig index 013d369..f7c81e2 100644 --- a/config/.gitconfig +++ b/config/.gitconfig @@ -7,7 +7,7 @@ process = git-lfs filter-process required = true [core] - editor = kak + editor = nvim [init] defaultBranch = master [sendemail] diff --git a/config/.scripts/rfv.sh b/config/.scripts/rfv.sh index d164c06..041ab3e 100755 --- a/config/.scripts/rfv.sh +++ b/config/.scripts/rfv.sh @@ -1,4 +1,4 @@ -rg --uu --color=always --line-number --no-heading --smart-case -H "${*:-}" | tr -d '\r' | +rg -uu --color=always --line-number --no-heading --smart-case -H "${*:-}" | tr -d '\r' | fzf-tmux --cycle -p 80%,90% --ansi \ --color "hl:-1:underline,hl+:-1:underline:reverse" \ --delimiter : \ From ef1981d06bdd4605d48597961db154be3136f1e4 Mon Sep 17 00:00:00 2001 From: Michael Chalupiak Date: Fri, 26 Dec 2025 11:40:48 -0500 Subject: [PATCH 2/2] multicursor (good this time) --- .../.config/nvim/lua/plugins/treesitter.lua | 8 + config/.config/nvim/lua/plugins/util.lua | 183 ++++++++++-------- 2 files changed, 109 insertions(+), 82 deletions(-) diff --git a/config/.config/nvim/lua/plugins/treesitter.lua b/config/.config/nvim/lua/plugins/treesitter.lua index 74df41d..5d5da80 100644 --- a/config/.config/nvim/lua/plugins/treesitter.lua +++ b/config/.config/nvim/lua/plugins/treesitter.lua @@ -8,6 +8,14 @@ return { config = function() require'nvim-treesitter.configs'.setup { textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + } + }, move = { enable = true, set_jumps = false, diff --git a/config/.config/nvim/lua/plugins/util.lua b/config/.config/nvim/lua/plugins/util.lua index a1f11d9..cfed35a 100644 --- a/config/.config/nvim/lua/plugins/util.lua +++ b/config/.config/nvim/lua/plugins/util.lua @@ -17,7 +17,7 @@ return { }, { - "sindrets/diffview.nvim", + "sindrets/diffview.nvim", event = 'VeryLazy', }, @@ -157,6 +157,10 @@ return { -- `z` key { mode = 'n', keys = 'z' }, { mode = 'x', keys = 'z' }, + + -- Localleader + { mode = 'n', keys = ''}, + { mode = 'x', keys = ''}, }, clues = { @@ -189,6 +193,8 @@ return { triggers = { { 'g', mode = { 'n', 'x' } }, }, + skip_confirm_for_simple_edits = true, + prompt_save_on_select_new_entry = false, }, -- Optional dependencies dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons @@ -245,85 +251,98 @@ return { event = 'VeryLazy', }, - -- { - -- "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"}, "", function() mc.lineAddCursor(-1) end) - -- set({"n", "x"}, "", function() mc.lineAddCursor(1) end) - -- -- set({"n", "x"}, "", function() mc.lineSkipCursor(-1) end) - -- -- set({"n", "x"}, "", function() mc.lineSkipCursor(1) end) - -- - -- -- Add or skip adding a new cursor by matching word/selection - -- -- set({"n", "x"}, "n", function() mc.matchAddCursor(1) end) - -- -- set({"n", "x"}, "s", function() mc.matchSkipCursor(1) end) - -- -- set({"n", "x"}, "N", function() mc.matchAddCursor(-1) end) - -- -- set({"n", "x"}, "S", function() mc.matchSkipCursor(-1) end) - -- - -- -- Add cursor at next argument treesitter - -- set({'n', 'x'}, ']A', function() - -- if vim.v.count < 1 then - -- mc.addCursor(']a') - -- else - -- for i=1, vim.v.count - 1 do - -- mc.addCursor(']a') - -- end - -- end - -- end, { desc = 'Create multicursor on next argument'}) - -- set({'n', 'x'}, '[A', function() - -- if vim.v.count < 1 then - -- mc.addCursor('[a') - -- else - -- for i=1, vim.v.count - 1 do - -- mc.addCursor('[a') - -- end - -- end - -- end, { desc = 'Create multicursor on previous argument'}) - -- - -- -- Add and remove cursors with control + left click. - -- set("n", "", mc.handleMouse) - -- set("n", "", mc.handleMouseDrag) - -- set("n", "", mc.handleMouseRelease) - -- - -- -- Disable and enable cursors. - -- set({"n", "x"}, "", 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"}, "", mc.prevCursor) - -- layerSet({"n", "x"}, "", mc.nextCursor) - -- - -- -- Delete the main cursor. - -- layerSet({"n", "x"}, "x", mc.deleteCursor) - -- - -- -- Enable and clear cursors using escape. - -- layerSet("n", "", 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 - -- }, + { + "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"}, "k", function() mc.lineAddCursor(-1) end, { desc = "Add cursor to previous line" }) + set({"n", "x"}, "j", function() mc.lineAddCursor(1) end, { desc = "Add cursor to next line" }) + set({"n", "x"}, "", function() mc.lineAddCursor(-1) end, { desc = "Add cursor to previous line" }) + set({"n", "x"}, "", function() mc.lineAddCursor(1) end, { desc = "Add cursor to next line" }) + set({"n", "x"}, "K", function() mc.lineSkipCursor(-1) end, { desc = "Skip previous line to add cursor" }) + set({"n", "x"}, "J", function() mc.lineSkipCursor(1) end, { desc = "Skip next line to add cursor" }) + + -- Add or skip adding a new cursor by matching word/selection + set({"n", "x"}, "n", function() mc.matchAddCursor(1) end, { desc = "Add cursor to next currently selected word" }) + set({"n", "x"}, "s", function() mc.matchSkipCursor(1) end, { desc = "Skip next instance of current word to add cursor" }) + set({"n", "x"}, "N", function() mc.matchAddCursor(-1) end, { desc = "Add cursor to previous currently selected word" }) + set({"n", "x"}, "S", function() mc.matchSkipCursor(-1) end, { desc = "Skip previous instance of current word to add cursor" }) + + set({"n", "x"}, "m", mc.operator, { desc = "Add cursors to text object" }) + set("n", "s", function() + vim.ui.input({prompt = "Match: "}, function(input) mc.operator({pattern = input}) end) + end, { desc = "Add cursors to regex match inside text object " }) + set("n", "*", function() + mc.operator({pattern = vim.fn.expand("")}) + end, { desc = "Add cursors to current word inside text object" }) + set("x", "s", mc.matchCursors, { desc = "Add cursors to regex match inside visual selection" }) + + -- Add cursor at next argument treesitter + set({'n', 'x'}, ']A', function() + if vim.v.count < 1 then + mc.addCursor(']a') + else + for _=1, vim.v.count - 1 do + mc.addCursor(']a') + end + end + end, { desc = 'Create multicursor on next argument'}) + set({'n', 'x'}, '[A', function() + if vim.v.count < 1 then + mc.addCursor('[a') + else + for _=1, vim.v.count - 1 do + mc.addCursor('[a') + end + end + end, { desc = 'Create multicursor on previous argument'}) + + -- Add and remove cursors with control + left click. + set("n", "", mc.handleMouse) + set("n", "", mc.handleMouseDrag) + set("n", "", mc.handleMouseRelease) + + -- Disable and enable cursors. + set({"n", "x"}, "", mc.toggleCursor, { desc = "Toggle multiple cursors" }) + + -- 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"}, "h", mc.prevCursor, { desc = "Make previous cursor primary" }) + layerSet({"n", "x"}, "l", mc.nextCursor, { desc = "Make next cursor primary" }) + layerSet({"n", "x"}, "", mc.prevCursor, { desc = "Make previous cursor primary" }) + layerSet({"n", "x"}, "", mc.nextCursor, { desc = "Make next cursor primary" }) + + -- Delete the main cursor. + layerSet({"n", "x"}, "x", mc.deleteCursor) + + -- Enable and clear cursors using escape. + layerSet("n", "", 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 + }, }