I wanted to change the behavior of some keys in the :h i_CTRL-X submode. For example, I wanted to use the following:

inoremap <expr> <C-f> pumvisible() ? "\<C-x>\<C-f>" : "<C-f>"

The keybinding above is supposed to let me use only <C-f> after I've enabled the popupmenu with <C-x><C-f>. For example, say, I have the following directory and file in my popup-menu:


By default, I have to enable filename-completion with <C-x><C-f> and move to bin/ directory with <C-n> and if I want to move into the directory, I need to get out of that submode, which I used to do with <C-x> so that with one key I just got out of that previous submode and started getting into that submode again.

One more keypress is not a big deal, but I thought I should be able to make it one keypress. I wanted to use <C-f> to get out of that submode and also get into it again. It's fairly simple, until I learnt that it doesn't work with normal inoremap cause it's a separate submode and <C-f> works as <C-n> in that submode as the suggestion in the echo area suggests:

-- File name completion (^F^N^P) match 1 of 2

So, I don't know what to do now. I have also tried imap directly by the way, so that's not it. Any idea how to get a workaround?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.