Live data from Hacker News

How to boost your Vim productivity

sheerun.net

31–40 of 130 posts

Re: How to boost your Vim productivity

#31

Why don't people seem to use the F keys? I have mappings for very frequent functions on F1-F5, and it really helps: map :w | "Fast save imap :w | "Fast save map :make | "Fast compile map :bn map :bp " Same mapping for gnome-terminal ( see http://stackoverflow.com/q/12813126/164171 ) map ^[O1;2R :bp map :bd | "Close buffer map :cnext map :cprev imap :cnext imap :cprev

"Why don't people seem to use the F keys?"

Probably because that doesn't fit well with touch typing. A great thing about vim is that you can do everything as a touch typist, without reaching for the outlying districts of the keyboard (assuming you've remapped the escape key to capslock, or learned to use ^[, or mapped it).

Re: How to boost your Vim productivity

#33

Why don't people seem to use the F keys? I have mappings for very frequent functions on F1-F5, and it really helps: map :w | "Fast save imap :w | "Fast save map :make | "Fast compile map :bn map :bp " Same mapping for gnome-terminal ( see http://stackoverflow.com/q/12813126/164171 ) map ^[O1;2R :bp map :bd | "Close buffer map :cnext map :cprev imap :cnext imap :cprev

One of my favorite bits for saving my own butt: commit more. "Function to commit. function! GitCommit () execute 'write' let message = input('Enter commit message: ') execute '!git add ' . bufname('%') . ' && git commit -m ''' . message . ''';' endfunction imap :call GitCommit() map :call GitCommit()

Have you tried fugitive (a vim wrapper around git)?

Re: How to boost your Vim productivity

#34
post #10

Earlier quoted context omitted.

Isn't :%s/.)/hello)/ simpler? Maybe that's because I know nothing about macros. Thanks for the explanation.

Pardon, it might have been a trivial example. I managed to find a real-world example I encountered in February this year. The PAPI library has a utility program papi_avail which prints a table of supported performance counters. The lines may look like this: PAPI_VEC_SP 0x80000069 Yes Single precision vector/SIMD instructions PAPI_VEC_DP 0x8000006a Yes Double precision vector/SIMD instructions PAPI_REF_CYC 0x8000006b…

I just spent minutes to parse that instruction. Mind blown. Thank you for this enlightenment.

Re: How to boost your Vim productivity

#38
post #20

Lately I use neovim, because it allows using 24 bit color themes in the terminal.

So neovim is usable now? Do you run into many problems with it?

I have been using it for months without any issues. It is actually a bit faster than regular vim.

Re: How to boost your Vim productivity

#39
post #12

Earlier quoted context omitted.

Isn't :%s/.)/hello)/ simpler? Maybe that's because I know nothing about macros. Thanks for the explanation.

I guess that would change the comment : "duh)" would become "hello)", whereas the macro does not.

No, not without a 'g' at the end.

Re: How to boost your Vim productivity

#40

Does anyone have any advice on bindings to change split size? Ctrl-w + and Ctrl-w - just don't work well, and my current configuration shadows Ctrl-a, which I really would like to avoid.

I rarely resize windows, but when I do, I set mouse=a and use the mouse to drag the window borders around. There's also CTRL-W _ (underscore) to maximize the current window and CTRL-W = to make window sizes equal.
Post reply on HN