1

I use the following mapping for <Tab>:

inoremap <expr> <Tab> getline('.')[col('.') - 2] =~ '\w' ? "<C-N>" : "<Tab>"

It works well except that if I want to insert a tab and the previous word is not matched, i_Ctrl-N returns the Pattern not found error and I have to insert a space manually and then I can insert a tab.

This is quite annoying. I know I can use pumvisible to detect if completion pop-up is visible, but how can I evaluate the return value of i_Ctrl-N?

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.