0

When I connect to a remote server via iterm2 and SSH and use vim on this server remapping to the Escape key doesn't work. Other key mappings in the .vimrc work as expected but inoremap jj <Esc> won‘t leave the insert mode but writes jj inside the text no matter how fast I type.

I tried an SSH connection with macOS's Terminal.app with the same result. Is this related to the SSH? How can I solve the problem?

Update:

:set to? tm?

returns

timeout
timeoutlen=1000

Update 2:

It seems that all normal and visual mode mappings work but insert mode mappings fail. I also tried

inoremap > <TAB>

without success.

:verbose set paste?

returns

    paste
         Last set from ~/.vimrc
7
  • 1
    Might be related to timeout and similar settings
    – D. Ben Knoble
    Apr 24 at 14:18
  • But how can I solve this issue?
    – Mountain
    Apr 24 at 14:51
  • What does :set to? tm? tell you? Does it say notimeout? Please update the question with the output of this command.
    – filbranden
    Apr 24 at 15:59
  • 1
    Have you double checked that the mapping actually exists? Does anything change if you set up the mapping manually from inside the Vim session, rather than from your vimrc?
    – Rich
    Apr 24 at 22:22
  • 1
    You say that other mappings work: are these insert mode mappings, or normal mode? If you don’t have any other insert mode mappings, can you try creating one? What is the output of :verbose set paste?
    – Rich
    Apr 26 at 11:39
0

With paste set, insert mode mappings are disabled (among other things). paste is only meant to be set during, well, a paste. Otherwise, leave it off.

1
  • Solved! Thanks, set nopaste was the key.
    – Mountain
    Apr 26 at 20:53

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.