Fast indent 1. Use commands to quickly adjust indent operations
This section learns how to indent quickly in vim and indent operations are effective in normal mode
Open a file for editing
$ vim protocols
- Normal mode input
15G
, jump to 15 lines
- Input entire line in normal mode
>>
indent right (used to format code super cool)
- Enter the entire line in normal mode to the
<<
left fallback
- Normal mode enter
:
command line mode to shiftwidth
set values to control the number of characters for indentation and fallback
2.shiftwidth command
shiftwidth
The command refers >>
to the indentation generated by the previous command (which can be abbreviated sw
). Enter :
command line mode to set values in normal mode to control the number of characters in shiftwidth
indentation and fallback get current setpoint
:set shiftwidth?
Set indent to 10 characters
:set shiftwidth=10
Enter ESC
back into normal mode and try again to >>
see if the indent changes
3. Adjust the text position
Command line mode enter :ce
(center) command to center the contents of the bank
:ce
Command line mode enter :ri
(right) command to make our text
:ri
Command line Mode enter: le
(left) command to leave the contents of the bank
:le
Vim Fast Indent