simnalamburt / vim-mundo

:christmas_tree: Vim undo tree visualizer
https://simnalamburt.github.io/vim-mundo
GNU General Public License v2.0
792 stars 28 forks source link

Mapping for MundoToggle doesn't work with "Ctrl-m" #109

Closed AchmadFathoni closed 2 years ago

AchmadFathoni commented 3 years ago

Using neovim 0.4.4 with this init.vim

call plug#begin('~/.config/nvim/plugged')
" Declare the list of plugins.
Plug 'simnalamburt/vim-mundo'
call plug#end()
nnoremap <C-m> :MundoToggle<CR>

When mundo graph is hidden and I press the Ctrl+m, mundo graph is able to appear and my cursor is inside it. If I press Ctrl+m again, nothing happen(I expect the mundo graph to hide). To successfully hide the mundo graph, I must move my cursor to the opened file buffer and then hit Ctrl+m.

This behavior is absent when use F2 as :MundoToggle shortcut.

simnalamburt commented 3 years ago

Successfully reproduced this bug, don't know the cause yet.

AchmadFathoni commented 3 years ago

<C-n> is also work. Maybe arbitrary ctrl button combination is not the cause.

idbrii commented 3 years ago

This is a limitation of vim.

<C-m> seems to be the same as <CR>, so that mapping is effectively the same as:

nnoremap <CR> :MundoToggle<CR>

Notice how highlighting a node and doing C-m results in mundo loading that state -- just like it would for CR.

Also see how vim's :help CTRL-M (and c and i variants) all show C-m and CR bound to the same commands. (I don't know why vim allows you to bind different things to them. Maybe it's a limitation of vim's input system on most platforms. Even gvim has this problem!) You should see similar issues with C-i (tab) and C-h (backspace).

simnalamburt commented 2 years ago

Confirmed that "control + m" has same input code with "enter", closing this issue since it's not an issue of vim-mundo.