Earlier 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…
How to boost your Vim productivity
61–70 of 130 posts
Re: How to boost your Vim productivity
#62Earlier 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…
Lord, that's so useful. I normally include a move to next line part in my macro and then guess at how many times to run it (20@q, repeat until I get it right). It's actually the main reason I often don't bother using macros. This is such a great tip. Thanks!
Another tip: when you forget to add the move to next line to your macro, you don't have to start over. You can append to a macro, just use the upper-case register name instead. So to append a down and move to beginning of line to macro 'a', you'd type qAj0
Re: How to boost your Vim productivity
#63The most productive mapping ever: imap jj . No more having to reach for the escape key.
Even better: imap jk imap kj I just hit both and j at the same time with my pointer and index fingers so it's essentially one keystroke.
Re: How to boost your Vim productivity
#64In 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…
\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 ..
Re: How to boost your Vim productivity
#65It is a long long time ago that someone taught me something really new about vim and used plugins that are not just fancy (looking at most status line plugins or nerdtree) but actually seem to improve productivity in a vim-ish sense. Kudos!
(Note: I turn rope off in python-mode because it's horribly inefficient, and sometimes causes Vim to delay reacting to user input)
Re: How to boost your Vim productivity
#66Why 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
#67vim scp://host//etc/whatever
Re: How to boost your Vim productivity
#68Does 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.
You can use "set winwidth=79". It'll automatically resize active column to at least 79 characters. I also use mouse for resizing.
Re: How to boost your Vim productivity
#69https://github.com/yramagicman/dotfiles/blob/master/.vim/aft...
Re: How to boost your Vim productivity
#70I disliked the part about setting up Vim on servers. Do you really want to be adding all the dependencies for your editor on every server? I'm an advocate of using the netrw plugin to edit over ssh directly and avoiding logging into servers when not necessary. vim scp://host//etc/whatever
You can also use .nvimrc instead .vimrc, so only nvim instance on server gets plugins.