vifm / vifm.vim

Vim plugin that allows use of vifm as a file picker
333 stars 19 forks source link

`nnoremap <c-\> :exit<cr>` is not triggered immediately #37

Closed mroavi closed 4 years ago

mroavi commented 4 years ago

I have the following mapping in my vifmrc:

nnoremap <c-\> :exit<cr>

The problem I'm facing is that I need to press <c-\> followed by any other key so that the command gets triggered. Any idea how to fix this? I noticed that this also happens with

nnoremap <c-b> :exit<cr>

but it doesn't happen with nnoremap <c-j> :exit<cr>

I'm using tmux:

❯ tmux -Version
tmux 2.6

and this version of vifm:

❯ vifm --version
Version: 0.9.1
Git info: built out of repository

Support of extended keys is on
Parsing of .desktop files is enabled
Without GTK+ library
With magic library
With X11 library
With dynamic loading of X11 library
With file program
With -n option for cp and mv
With remote command execution
xaizek commented 4 years ago

Looks like you have other mappings that start with <c-\>. Try doing :nnoremap <c-\> to list them.

mroavi commented 4 years ago

Apparently not: It outputs No mappings found.

xaizek commented 4 years ago

tmux

Does it happen outside of tmux? I think Ctrl+B is its default prefix key, Ctrl+\ might also be handled by it in some way.

mroavi commented 4 years ago

I just found out that I missed a very important point in the description of the problem. Yesterday, I was observing this issue in both normal vifm and also in Vim's vifm plugin. Today I'm seeing that this only occurs with Vim's vifm plugin. I should probably move this issue to the vifm Vim plugin.

mroavi commented 4 years ago

Could you transfer this issue to https://github.com/vifm/vifm.vim?

xaizek commented 4 years ago
Special in the terminal window:         *t_CTRL-W_.*  *t_CTRL-W_N*
...
    CTRL-\ CTRL-N   go to Terminal-Normal mode, see |Terminal-mode|

So if you run vifm inside tmux inside Vim, that explains issues with both keys.

Can't move the issue now, github fails to open issue transfer form.

mroavi commented 4 years ago

Oh wow. Great catch. I didn't even know about the existence of this Terminal-Normal mode. Is it possible to unmap CTRL-\ CTRL-N? Probably not because it is a Vim internal command, right?

xaizek commented 4 years ago

I don't think it's possible, you have to always type it using 'termwinkey', so Ctrl+WCtrl+\ if you haven't changed the option.

mroavi commented 4 years ago

Vim has two mappings for the exact same thing. What a shame that I cannot unmap the latter one:

    CTRL-W N    go to Terminal-Normal mode, see |Terminal-mode|
    CTRL-\ CTRL-N   go to Terminal-Normal mode, see |Terminal-mode|
xaizek commented 4 years ago

The first one depends on the value of 'termwinkey', the second one is always there. I guess the second one is meant to be used in user mappings.

mroavi commented 4 years ago

Clear. Thanks a lot @xaizek. It's now clear to me why I can't close Vim's vifm plugin with <C-Bslash>. I will close this issue.