News for hackers. Stuff that matters.
Re:Use Vim Like A Pro by gfodor on Sunday October 31, 2010 @06:12PM (#1854497)
Another important vim tip for me that wasn't in there and might be one for the author himself: you can use ctrl-C or ctrl-[ instead of ESC to exit insert mode. This, combined with re-mapping capslock to control, is a big, big win.
Re:Use Vim Like A Pro by chancho on Sunday October 31, 2010 @07:24PM (#1854704)
Ctrl-c and ctrl-[ are not the same. There are times when latter completes the insert session (same as esc) while the former aborts it, e.g. visual block insertion with (ctrl-v jjjj I)

Also, the happy haacking keyboard already puts control in its proper place and puts esc where ~ normally is, which is close enough that you don't really need to remap it. Best vim keyboard ever.

Re:Use Vim Like A Pro by pyre on Sunday October 31, 2010 @11:47PM (#1855283)
It's more helpful to think of ctrl-[ as an analog to ESC (this also works in Emacs, irssi, etc as well IIRC). Ctrl-c just happens to work for exiting Insert mode because ctrl-c is the 'abort' command, and technically Insert mode is an operation.

Insert mode is not Vim's 'normal' mode. When you enter Insert Mode, you are basically saying, "I'm stepping out of normal mode for a bit to enter some text here." In this sense, hitting ctrl-c is telling Vim that you're aborting your insert operation. (Though I could just be talking out of my ass, and it was just bound that way as a convenience)

Re:Use Vim Like A Pro by wyclif on Monday November 01, 2010 @08:35AM (#1856180)
keyboard already puts control in its proper place and puts esc where ~ normally is, which is close enough that you don't really need to remap it

Unicomp makes a Model M that does this as well, very worthwhile if you are a vim or Emacs user: http://pckeyboards.stores.yahoo.net/linux101.html

Re:Use Vim Like A Pro by throw_away on Sunday October 31, 2010 @07:08PM (#1854661)
but be sure to choose something you won't mind typing in regular non-vim contexts as well, as you'll eventually pick up a habit of hitting your <esc> equivalent pretty much whenever you stop to think. <ctrl-w> would be a horrible choice :)
Re:Use Vim Like A Pro by klochner on Sunday October 31, 2010 @06:48PM (#1854607)
It's also common to remap ii to exit insert mode, that way "i" puts you in, "ii" takes you out.

Personally, I remapped caps lock to esc, because I don't like the way the editor lags when typing an "i" after "ii" has been remapped, but Caps-->Ctrl has the additional benefit of making other Ctrl-Foo sequences easy.

Re:Use Vim Like A Pro by pyre on Monday November 01, 2010 @12:42AM (#1855398)

  > Personally, I remapped caps lock to esc, because I don't like the
  > way the editor lags when typing an "i" after "ii"
That's the problem with mapping non-Ctrl/Alt sequences in Insert mode. Even thing like bindings that automatically insert a closing } (with auto-indent) when you type the opening { are really annoying because they are commonly bound to the sequence "{<Enter>". So when you type { without <Enter> there is a delay while it waits to see if you're going to hit <Enter>.
Re:Use Vim Like A Pro by stuhacking on Monday November 01, 2010 @07:13AM (#1856020)
How would one insert the string 'ascii'?
Re:Use Vim Like A Pro by gfodor on Monday November 01, 2010 @03:42PM (#1857899)
You can always force a literal insertion via ctrl-v. So,

asc<C-v>i<C-v>i

in insert mode.

Re:Use Vim Like A Pro by klochner on Monday November 01, 2010 @11:12AM (#1856720)
very slowly
Re:Use Vim Like A Pro by jberryman on Sunday October 31, 2010 @08:29PM (#1854851)
I remapped esc to jj based on some excellent blog post I recently read and I love it. Will get the link or post how if anyone is interested.
Re:Use Vim Like A Pro by ed on Monday November 01, 2010 @12:24AM (#1855361)
Probably this one: http://news.ycombinator.com/item?id=1710702

That's where I picked it up, too :-)

Incidentally I also remap jh to write & exit insert mode (inoremap jh <ESC>:w<cr>). This turns out to be super helpful for web development, which often requires that you hop over to a browser after modifying code.

Re:Use Vim Like A Pro by tel on Monday November 01, 2010 @10:12AM (#1856490)
It may not have quite the same effect but

   :au FocusLost * :wa
should autosave when you switch to the browser without requiring keypresses.
Re:Use Vim Like A Pro by thecoffman on Monday November 01, 2010 @10:39AM (#1856594)
This gets annoying sometimes if you're working in an unnamed file. If you haven't saved yet, or don't intend to (just a scratch buffer or something) it throws an error every time you switch contexts.
Re:Use Vim Like A Pro by graywh on Monday November 01, 2010 @10:34AM (#1856578)
Only when using gVim.
Re:Use Vim Like A Pro by SkyMarshal on Sunday October 31, 2010 @10:33PM (#1855147)
Was it this one:

http://news.ycombinator.com/item?id=1687701

I did the same thing, based on that post.

Edit: er, maybe not that one, can't find it in the page. Could have sworn that was it though...

Re:Use Vim Like A Pro by jjcm on Sunday October 31, 2010 @07:15PM (#1854681)
I personally just remap capslock to ESC directly. I'm in vim a large majority of the time that I'm working, so it's a very big jump in productivity for me.
Re:Use Vim Like A Pro by clvv on Sunday October 31, 2010 @07:34PM (#1854723)
Some vim users also remap their caps lock to Esc (modify ~/.Xmodmap on linux, also doable on Windows and Mac), whereas Emacs users will probably remap their caps lock to Ctrl.
Re:Use Vim Like A Pro by pyre on Monday November 01, 2010 @12:44AM (#1855404)
Most Vim users that I know map CapsLock to Ctrl and just use C-[ (or C-c situation permitting) for Esc
Re:Use Vim Like A Pro by phob on Monday November 01, 2010 @03:16PM (#1857780)
| situation permitting

Yep, that's good 'ol vim for you.

Re:Use Vim Like A Pro by viraptor on Sunday October 31, 2010 @06:45PM (#1854599)
You can remap ESC to whatever you need. I prefer CTRL+s == ESC:

    inoremap <C-s> <ESC>
    vnoremap <C-s> <ESC>
Re:Use Vim Like A Pro by rue on Sunday October 31, 2010 @10:13PM (#1855104)
I have mapped hh (jj on a QWERTY) to ESC.
Re:Use Vim Like A Pro by atuladhar on Sunday October 31, 2010 @06:22PM (#1854530)
Thank you!