3 ms·
This works in all filetypes, and the indentation amount is set by shiftwidth. Whether tabs or spaces are inserted is controlled by expandtab (for spaces) or noe
by tremon 3y ago
This works in all filetypes, and the indentation amount is set by shiftwidth. Whether tabs or spaces are inserted is controlled by expandtab (for spaces) or noexpandtab (use tabs).
You can use any navigation command as the target, I find myself often using
>}
to indent every line until the end of the block.
- cerved 3y agoor >ap
- fuzztester 3y ago>You can use any navigation command as the target, I find myself often using > >} >to indent every line until the end of the block. Yes, that's a good one for code in languages where } marks the end of a block, such as C, C++, Java, etc. I also use >G to indent from current line to end of file in a text file, or 1G>G which is 1G to go to line 1, and then >G to indent to end of file, which indents the whole file, which can be useful for printing on paper, more so when combined with other options like shiftwidth, !fmt, etc. (also mentioned in this thread). And many other such combinations of the indent operation and some movement, for structuring text or code, are possible. All such combinations are based on the same principles mentioned in the Stack Overflow "grok vi" comment that I posted about in this thread: https://news.ycombinator.com/item?id=37018215 https://news.ycombinator.com/item?id=37018215