Live data from Hacker News

Vim After 11 Years

statico.github.com

101–110 of 254 posts

Re: Vim After 11 Years

#101

Can vim do the following? I'm editing some project with 10000 C++ files. There is some C++ file I currently don't have open, say "palette.cpp" which is in a subdirectory "project/graphics/algorithms/color/". Now I want to open palette.cpp without ever having to type, not even with tab autocompletion, that path. IntelliJ (which I do use for C++ ;)) can do this easily: just press CTRL+R, then palette.cpp, ENTER, and th…

CtrlP takes care of that. Ctrl+P and then Ctrl+F (cycle to buffers list—you can also map this to anything you want) and it will list buffers with a + next to the buffers with local edits. Ctrl+D and it will change from full path to file name search. You can cycle between buffers, files, mru files and even more (tags, etc.) with extensions.

Re: Vim After 11 Years

#102
post #99
post #95

Earlier quoted context omitted.

I have space mapped to execute the macro in 'q': noremap @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 ;)

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.

Yeah, that's how I use macros that I anticipate remaining useful longer.

Re: Vim After 11 Years

#105
post #64

Earlier quoted context omitted.

Here are few things how I use it: - scrolling with a mouse wheel - selecting/resizing a split window - jumping to a specific place in the code - making a selection

All of that can be done much more efficiently without the mouse: - scrolling with a mouse wheel :h scroll.txt - selecting/resizing a split window :h window-resize :h window-move-cursor - jumping to a specific place in the code /foo or the myriad of cool things in :h motion.txt - making a selection v{motion}

bam

  "narrower window
  map - >
  "shorter window
  map _ -
  "taller window
  map = +

Re: Vim After 11 Years

#107
post #48

Can vim do the following? I'm editing some project with 10000 C++ files. There is some C++ file I currently don't have open, say "palette.cpp" which is in a subdirectory "project/graphics/algorithms/color/". Now I want to open palette.cpp without ever having to type, not even with tab autocompletion, that path. IntelliJ (which I do use for C++ ;)) can do this easily: just press CTRL+R, then palette.cpp, ENTER, and th…

The CtrlP plugin will make opening these files a breeze. If you just trigger it and type palette.cpp, it should be the first match.

with your cursor on a filename that is a legitimate relative path, you can just press 'gf' to open the file from command mode. there is also a mirrored command of '^xf' in insert mode. slightly different work flow...

^o and ^i get used a lot in conjunction with 'gf', and are also pretty handy in general.

Re: Vim After 11 Years

#108
post #88

Some small vim tweaks I've recently been using myself that I find very nice: nmap :write 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…

Space is my leader key.

Re: Vim After 11 Years

#110
post #88

Some small vim tweaks I've recently been using myself that I find very nice: nmap :write 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…

I use space for toggling folding:

  " space toggles the fold state under the cursor.
  nnoremap  :exe 'normal! za'.(foldlevel('.')?'':'l')
  " space expands with zO
  map  zO
Post reply on HN