Tuesday, January 27, 2015

Mapping the Escape Key

I'm trying to switch CTRL-C and Escape since CTRL-C is closer but I prefer Escape for most things. I'm using the noremap command to do this and for some reason I'm getting strange behavior when starting up Vim. I have the 'showcmd' option set and I can see that when I start Vim the visual bell goes off (like when Escape is hit in normal mode) and Vim is in operator-pending mode in the middle of a 2c command/operation. This all is quite annoying since it deletes 3 lines and starts inserting j's when I try to scroll down.

I've been able to reproduce this problem on both my Macbook's Vim and on my Windows work computer ssh'ed into a linux box using various ssh clients also running Vim.

I've been trying to track this down for awhile but this is all I've found out so far:

- When the mapping is made with the 'compatible' option set this becomes a non-issue
- On my Macbook I recently mapped the terminal scroll key codes for scroll up (^[OA) and scroll down (^[OB) to CTRL-Y and CTRL-E respectively. When at least one of these mappings in uncommented in my .vimrc this again becomes a non-issue

I'm using Vim 7.3 on my Macbook, not sure the version on my work computer but I think it's 7.4.

All that needs to be in my .vimrc for this mishap to happen is the Escape mapping itself:

noremap <Esc> <C-c>

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: