sponsor Vim development Vim logo Vim Book Ad

intermediate Tip #314: Insert and back...

 tip karma   Rating 13/10, Viewed by 1846 

created:   August 14, 2002 16:29      complexity:   intermediate
author:   Alex A. Naanou      as of Vim:   5.7

this is related to vimtip #289 in terms of programmers (like I) too lazy to move their hands to reach the far far away <esc> key.... joking! :)
  actually the less your hands move around the faster you type, and the fester you type the more time you have on your hands to think of "what" you type...

here is a small snippet from my mappings file, ready to speed things up:
// the key overloading might be a somewhat confusing at first....

--cut---
imap <S-Space> <esc>l
imap <C-CR> <esc>o
imap <S-CR> <esc>O

nmap <S-Space> i
nmap <space><space> i
nnoremap <CR> o
nmap <S-CR> O

---uncut---

Good luck!!

 rate this tip  Life Changing Helpful Unfulfilling 

<<printing using kprinter (unix + kde) | "Smart <home>" >>

Additional Notes

viking at vi.king.net, August 16, 2002 7:54
I would rather extend my pinky quickly to <ESC>
than pressing two keys at the same time.
What is wrong with <ESC> key ?
By trying to press <SHIFT> "and" <SPACE> at the
same time, your whole hand is already moved downward,
which actually delays the process. I think that you are not
a touch typist, in which case this is not bothering at all.
However, for the touch typist, moving the whole hand is
the most annoying thing.
By pressing <ESC> alone with your pinkie, you don't need to
move your whole hand, and get back to the your typing very
quickly without looking at the keyboard.
Alex A. Naanou <alex_nanou at yahoo.com>, August 16, 2002 16:19
  I personally rest my hands on the keyboard, so as to have my forefingers relaxed on "f" and "j", my thumbs on "<space>", pinkys on "<Caps>" and " ' ", and the middle fingers touching the "number keys". so I reach all the keys without lifting or moving either hand. all but the function keys and <esc> to get to which I have to lift the whole arm, and that turns into a problem as the escape key gets pressed almost as often as the shift key.
  so what was proposed by Jeffrey Lim in vimtip #289 was quite natural for me, all but the double <S-Space> which I find a bit slow...

  which mappings work for you an which don't, depends on how you hold your hands, your typing style and maybe you keyboard, and that is your choice to make...

Best Regards...
Alex.
enviameloa at hotmail.com, August 17, 2002 13:11
I personally found mapping <esc> key to a double pressing "J"  while in insert mode faster and very convinient.

imap jj <esc>

give it a try,
by
viking at vi.king.net, August 21, 2002 9:40
mapping jj to ESC... What an excellent idea !
There is no occasion to type jj in any situation,
so jj should be just fine. Yes, it should be much faster.
But I still need to make it as my habit. Still, because of
my habit, extending my pinkie to ESC is faster at
this moment.
Thanks a lot ! :-)
Alex A. Naanou <alex_nanou at yahoo.com>, August 21, 2002 17:24
Cool!!  I think this one is worth the adaptation period!! :)
   pressing one button in the middle of the keyboard twice is a lot more intuitive than <S-Space>, and may be quite a speedup if you spend the time to get used to it.....

Thanks!!
nithin_sujir at yahoo.com, September 13, 2002 17:47
Ya jj is good. I'm used to <M-j>
jamesb at panmatrix.net, October 19, 2002 15:13
> There is no occasion to type jj in any situation,

Yeah, except when you're trying to add it to your .vimrc file.  ;)

Great idea.

rando at babblica.net, November 6, 2002 4:42
Of course, if you ever DO need to actually type j twice, you can wait a half second or so between them (until the cursor moves).

Though Idunno if I could ever get used to something like this. the escape key isn't that far away. ;)
dev at gaspardbuma.org, June 10, 2003 0:41
Hi !
I got used to work with the US keyboard layout (much better for programming : easy access to ;:/.?\"]}[{<>) instead of the swiss-french one. I found the idea of jj great, but decided to use jk (faster, two muscles driven, fun).

impa jk <Esc>

ps : more over, jk makes joke if you try to say it, and that's very cool.
dev at gaspardbuma.org, June 10, 2003 0:43
sorry for the misstyping :
imap jk <Esc>
fatboyco93 at hotmail.com, February 6, 2004 2:18
Hey,
I seemed to type the imap thing just as you said but it doesn't seem to work.
I typed
imap jj <Esc>
in my .vimrc file but when i'm insert mode it just gives me a bunch of jj's.  Is it just me?

Chad
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge Logo