A few of these are good suggestions but I can't live without C-v, whether I am already in visual mode or not. Block selection may not be used that frequently but when it is, it's a lifesaver.
How to boost your Vim productivity
71–80 of 130 posts
Re: How to boost your Vim productivity
#72Earlier quoted context omitted.
Suppose a range of lines contains function calls in some programming language: i = foo(a, 42, 1) j = bar(b, c, 100, 2) # this is a comment (well, duh) bazbar(etc, 3) You want to edit the last parameter in each function call -- change it to 'hello'. I have two ways of approaching this: macros (interactive) or :norm (less interactive). 1. Put your cursor on the first byte in the first line, type qq to record a macro of…
care to suggest any resources that helped you reach wizard-like levels of usage? I very much wish to work towards that kind of ability in vi/vim.
Re: How to boost your Vim productivity
#73In my 6 years of coding and writing LaTeX in Vim, I have found that the greatest boost to my Vim productivity is learning all about the vi and ex foundation of Vim. My Vim knowledge applies 100% to any default Vim installation on a modern distro, and my vimrc contains mostly trivial tweaks. This means using :normal and macros instead of :s for most of my search/replace actions; using H, M, L, {, } to navigate quickly…
when I learned about f and F a whole new world opened up for me. It never ceases to amaze me how amazing vim is. Another quick thing I recently learned (yes, novice vim user here) is stuff like this \includegraphics{test.png} if you stand inside the curly brackets and type ciB (change in Brackets) you get this \includegraphics{} with your cursor active inside the brackets, just awesome ..
(I think of "B" as beginning of a Word [including punctuation], so it would confuse me to use the "B" meaning braces)
Re: How to boost your Vim productivity
#74Re: How to boost your Vim productivity
#75Earlier quoted context omitted.
"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).
Additionally, on many keyboards (specifically Apple keyboards), you have to hit a modifier key plus the function key. For example, you have to hit Fn + F1 to get F1 because otherwise it's the "Lower LCD Brightness" hotkey. This makes them even less useful.
Re: How to boost your Vim productivity
#76Earlier quoted context omitted.
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.
Also, did you know that Ctrl-w | maximizes the a window horizontally? So if you have splits open above and beside you ctlr-w _ ctrl-w | will maximize your current split. immediately maps this to ctrl-w m
Re: How to boost your Vim productivity
#77Re: How to boost your Vim productivity
#78Earlier 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…
As a side note, I love how Vim is basically a functional programming language for text editing.
Re: How to boost your Vim productivity
#79Earlier quoted context omitted.
^W20+ - increase the current window height by 20 lines ^W20> - increase the current window width by 20 columns :he ctrl-w edit: typo
I read the help, it's pretty awesome. There's a few bindings in there that I had no clue existed, like Ctrl-w {H J K L} to rotate windows, and ctrl-w f to split window and edit the file under the cursor. My problem is that the default bindings are just a pain to type. Ctrl-w + is a lot of work when you have your window navigation bindings set to CTLR - { h j k l }
Re: How to boost your Vim productivity
#80Earlier quoted context omitted.
Wow I have only been using H and L, and only because of you have I come to know M, {, and }. Thank you! But would you mind giving an explanation as to what the other things you listed do (f/F/t/T/;/,)? From just playing with them, it seems like f goes to the next character that you type and F does the same but backwards. t/T does the same but instead of going to the character it goes one before/after. I can't figure…
They are documented in :help left-right-motions, which you can also read at http://vimdoc.sourceforge.net/htmldoc/motion.html#left-right... . fx moves the cursor to the next occurrence of x, and semicolon repeats the search. To repeat the search in the opposite direction, use comma. 4tx moves the cursor right before the 4th occurrence of x right of the cursor in the line. F and T move backwards instead of forwards; i…
I use t / f a lot when cutting things, though there's probably a better way (from the article, I just discovered gn to visually select the next item matching the previous search).
eg, I might have a name that I want to replace in a couple of spots so I find it easy to do something like:
/AIDOScfSNEWNAMEn.n.n.
It's generally when it's a bit less calculated. If I knew I was replacing a load of stuff I'd use :%s/AIDOS/NEWNAME/gc