tpope / vim-unimpaired

unimpaired.vim: Pairs of handy bracket mappings
https://www.vim.org/scripts/script.php?script_id=1590
3.34k stars 204 forks source link

Consider using `<Cmd>` instead of `:` in mappings #231

Open gegoune opened 1 year ago

gegoune commented 1 year ago

Using : in all mappings produces undesired triggering of cmdline popup with Neovim's Noice.nvim plugin. It basically makes popup appear and flash with commands as they execute. I have asked on neovim channel about it and was told that

Is that something you could consider? Thank you for get plugin, it's so fundamental to my workflow.

tpope commented 1 year ago

I'm not going to raise the Vim minimum version from 7.4.0000 to 8.2.1978, but I'd be open to a hybrid approach.

halostatue commented 2 months ago

I’ve made a vim9script fork of vim-unimpaired and use <ScriptCmd> in a number of places instead of :, but <Cmd> and <ScriptCmd> have an unexpected side-effect which forced me to completely redo the toggle mapping (I like what I’ve done, but it's a big change): <C-R>= is not available. There are a number of places where vim-unimpaired uses <C-R>= to perform conditional behaviours (e.g., <C-R>=&op ? set noop : set op<CR><CR>) that I had to replace with an explicit if|else|endif construct.

tpope commented 2 months ago

Note the option maps are designed to be seen so you can verify their effect. That's why they don't use <silent>. I wouldn't use <Cmd> for those even if I converted the others.

This raises a question: Does Noice.nvim show a popup for <silent> maps? That seems like a mistake.