News for hackers. Stuff that matters.
Re:Vim After 11 Years by gfodor on Tuesday February 19, 2013 @01:32PM (#5246077)
Some small vim tweaks I've recently been using myself that I find very nice:

nmap <CR> :write<CR>

cabbrev w nope

Re-map enter to save the file. If you try to do a :w it will yell at you until you take out the cabbrev so you can retrain your muscle memory. Took me about a day to retrain.

let g:EasyMotion_leader_key = ';'

nmap s ;w

nmap S ;b

Remap s and S to be easymotion forward and backward. I never use s, since it's largely a redundant command, and didn't like having to do a two key command for easymotion. (You can set the leader key to whatever here, the nmap's are the important part.)

noremap <C-H> <C-W>h

noremap <C-L> <C-W>l

noremap <C-J> <C-W>j

noremap <C-K> <C-W>k

Move between panes with motion keys with control held down.

Also the YouCompleteMe plugin got some HN airtime but it really needs to get more. It's amazing.

http://valloric.github.com/YouCompleteMe/

And as others have mentioned using vim inside of tmux is very nice. It's especially helpful to remap the entire tmux keymap to be vim-like.

Also, does anyone have any suggestions for what to re-map Space to? I am amazed Enter and Space in command mode both do relatively useless things. Remapping space to page down is OK but I use ctrl-f/b which is just as fast imho.

Re:Vim After 11 Years by edanm on Tuesday February 19, 2013 @04:16PM (#5247086)
I use space as my easymotion leader key. So <space>-w goes forward by word, <space>down does easymotion down, etc.

I used to use space as my "clear all searches and clear the echo-line" command, but decided space is too big and easymotion is too good to not pair them. I now use <leader><leader> to do the all-clear command.

Re:Vim After 11 Years by phaedrix on Tuesday February 19, 2013 @02:50PM (#5246608)
I use space for toggling folding:

  " space toggles the fold state under the cursor.
  nnoremap <silent><space> :exe 'normal! za'.(foldlevel('.')?'':'l')<cr>
  " <leader>space expands with zO
  map <leader><space> zO
Re:Vim After 11 Years by q_revert on Tuesday February 19, 2013 @03:04PM (#5246694)
same here, but use

   nnoremap <Space> za   
   vnoremap <Space> za
also, for folding in general I'd recommend using

  set foldmethod=marker
which has the benefit of making folds more 'transparent' in your code, and also persistent across vim sessions
Re:Vim After 11 Years by ckw on Tuesday February 19, 2013 @02:43PM (#5246571)
Space is my leader key.
Re:Vim After 11 Years by straws on Tuesday February 19, 2013 @06:43PM (#5247943)
Same, and return is my BufExplorer. Lightning fast.
Re:Vim After 11 Years by gfodor on Tuesday February 19, 2013 @02:57PM (#5246650)
solid!
Re:Vim After 11 Years by senekisa on Tuesday February 19, 2013 @04:41PM (#5247244)
yeah
Re:Vim After 11 Years by Anderkent on Wednesday February 20, 2013 @06:02AM (#5249806)
YouCompleteMe claims to work with omnifunc-based completion engine, but I couldn't get that to work. Can't tell if it's YCM or foreplay that's dropping the ball, but they don't seem to work together (i.e. I get foreplay completions when I trigger omni completion, but not dynamically via YCM).

EDIT: disregard me, it was a stupid configuration error (both plugins mapped the same key for completion, and foreplay won)

Re:Vim After 11 Years by jlgreco on Tuesday February 19, 2013 @01:46PM (#5246196)
I have space mapped to execute the macro in 'q':

  noremap <Space> @q
This lets me set a macro by first wacking qq, then q to finish, and then replay it by wacking space. I find myself using quick throw-away macros that only have a use for maybe 10 seconds far more often with this setup. (Plus wailing on the spacebar to get work done can be really satisfying ;)
Re:Vim After 11 Years by gfodor on Tuesday February 19, 2013 @02:08PM (#5246347)
This ain't bad but you know you can re-execute last macro with @@? So it ends up being @q and then hold down the @ key to repeat.
Re:Vim After 11 Years by jlgreco on Tuesday February 19, 2013 @02:14PM (#5246380)
Yeah, that's how I use macros that I anticipate remaining useful longer.