Following this answer I've been using vim-submode for some months on a windows gVim. Now that I'm trying to apply the same configuration on a terminal vim on linux I have some problems:

With the folowing lines:

call submode#enter_with('test', 'n', '', '<leader><UP>', '<C-w>-')
call submode#map('test', 'n', '', '<UP>', '<C-w>-')

LeaderUp let me enter in the submode test without any issue but in this submode when I hit Up I leave the submode and insert a A character in my buffer.

If I replace the second line with:

call submode#map('test', 'n', '', 'a', '<C-w>-')

Everything works properly i.e. hitting a execute the submode command.

The issue comes from the terminal which doesn't interpret correctly the arrow key because the commands works perfectly fine on a gVim on the same system.

My problem is that I don't understand why this happens because:

  • The arrow key is correctly interpreted in the enter_with mapping. Even if I replace the first line with call submode#enter_with('test', 'n', '', '<UP>', '<C-w>-') hitting Up will trigger the submode

  • I can create a mapping like nnoremap <Up> :echo "FOO"<CR> which will work properly.

I've tried to replace '<UP>' with the code of the arrow using Ctrl+r Ctrl+r Up to insert it which gave me OA but that still doesn't work.

My setup is:

  • Debian Wheezy
  • rxvt Unicode
  • vim 7.4

What can I do to solve my problem?

  • You should try <Esc>a. – romainl Aug 26 '15 at 7:21
  • Perhaps configure urxvt? (e.g. something like bbs.archlinux.org/viewtopic.php?id=71462) – VanLaser Aug 26 '15 at 10:44
  • @romainl: I don't understand where you think I should try <ESC>a I don't want to use a in my mapping but <UP> – statox Aug 29 '15 at 21:18
  • @VanLaser: That might be a good way but I have to say that I don't understand how keycodes works. I tried to remap URxvt.keysym.Up but all I could do was messing the behavior of my terminal. – statox Aug 29 '15 at 21:32
  • When you press <Up>, Vim doesn't receive <Up> but <Esc>A or some variant depending on your terminal emulator and/or $TERM. Either you map the actual escape sequence in Vim or you configure your terminal emulator so that it sends something that makes more sense. – romainl Aug 29 '15 at 21:53

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.