From 85372e648b5515b94e6b8af9d74f681302a6d126 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Wed, 29 Oct 2025 22:10:24 +0000 Subject: [PATCH] nvim: replace replacewithregister and sort with mini.operators This fixes the issue where gr* were now configured to do LSP stuff. I've got LSP key on \r instead. It might be worthwhile to reconsider that and use the official LSP bindings, but atm griw is soo engrained in muscle memory that it was frustrating for it to not do what was expected. --- nvim/lazy-lock.json | 1 + nvim/lua/plugins/editor.lua | 3 +++ vim/vimrc | 18 ++++++++---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 1dbef12..698843c 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -32,6 +32,7 @@ "mini.hipatterns": { "branch": "main", "commit": "5629d5fba132b4ab0b3f0039549308421f65ff45" }, "mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" }, "mini.indentscope": { "branch": "main", "commit": "8ce41a77eed7f4121c83c67fda5e2e86af999e6d" }, + "mini.operators": { "branch": "main", "commit": "1d0d1e1570e5bd22e6df3bcb068d0a2ac0d30710" }, "mini.pairs": { "branch": "main", "commit": "b9aada8c0e59f2b938e98fbf4eae0799eba96ad9" }, "mini.surround": { "branch": "main", "commit": "444e155147e2b5159dd28a65f9736254c16cb817" }, "neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" }, diff --git a/nvim/lua/plugins/editor.lua b/nvim/lua/plugins/editor.lua index 07e0a10..f5bfd74 100644 --- a/nvim/lua/plugins/editor.lua +++ b/nvim/lua/plugins/editor.lua @@ -94,6 +94,9 @@ return { } end, }, + { "nvim-mini/mini.operators", -- text edit operators + opts = {}, + }, { "folke/flash.nvim", -- Flash enhances the built-in search functionality by showing labels -- at the end of each match, letting you quickly jump to a specific diff --git a/vim/vimrc b/vim/vimrc index a0bea2a..8cf8255 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -201,9 +201,15 @@ if !has("nvim") " staging Plug 'puremourning/vimspector' " replaced by lsp {{{2 let g:vimspector_enable_mappings = 'HUMAN' - " }}} Plug 'vim-scripts/syntaxrange' " replaced by treesitter {{{2 - " }}} + Plug 'vim-scripts/replacewithregister' " replaced by mini.operators {{{2 + " sort operator replaced by mini.operaters {{{2 + function! SortLinesOpFunc(...) + '[,']sort + endfunction + nnoremap gs :set operatorfunc=SortLinesOpFuncg@ + vnoremap gs :sort + " }}}2 endif Plug 'alepez/vim-gtest' @@ -248,7 +254,6 @@ Plug 'tpope/vim-speeddating' Plug 'tpope/vim-unimpaired' Plug 'tweekmonster/spellrotate.vim' " Plug 'vim-scripts/mediawiki.vim' " TODO: delete? -Plug 'vim-scripts/replacewithregister' " FIXME: is overridden by lsp Plug 'wincent/loupe' " text objects @@ -925,13 +930,6 @@ if !exists(":DiffOrig") \ | wincmd p | diffthis endif -" sort operator {{{2 -function! SortLinesOpFunc(...) - '[,']sort -endfunction -nnoremap gs :set operatorfunc=SortLinesOpFuncg@ -vnoremap gs :sort - " edit configs {{{2 " TODO: populate location list with both .vim and .lua files " TODO: create file if it doesn't exist in nvim or vim rtps -- 2.50.1