Monday, November 24, 2025

Re: Mapping behavior in vim



On Saturday, November 22, 2025 at 12:48:02 PM UTC-5 Ven Tadipatri wrote:
Hi,
  I've installed git gutter for Vim, and I was hoping to get the navigation working. After a long conversation with ChatGPT, and no working solution, I was hoping to get some help from real vim users with mapping "bracket c" to navigate to the next hunk (using Vim 9.1 on WSL). This is what I tried in my ~/.vimrc

" GitGutter hunk navigation
"Failed attempt 1
nmap ]c <Plug>(GitGutterNextHunk)
nmap [c <Plug>(GitGutterPrevHunk)

AFAICT, the docs suggest this is correct: https://github.com/airblade/vim-gitgutter/blob/488c0555e47e2aabe273c635f7dd233e985311a6/doc/gitgutter.txt#L291. Indeed, the code still uses the mapping style that should make this work: https://github.com/airblade/vim-gitgutter/blob/488c0555e47e2aabe273c635f7dd233e985311a6/plugin/gitgutter.vim#L220.

So it might help if you describe how these failed.

You could also try

    nnoremap ]c <cmd>GitGutterNextHunk<enter>

and similar, since the user command works fine for you.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/7aeae513-06ab-4399-b8ac-85f773cbdb84n%40googlegroups.com.

No comments: