Enable and disable code indentation in vim
In vim by default code indentation are not enable so to enable the code indentation in vim we need to set it manually also we can disable.Here i am describe how to enable and disable code indentation in vim.
This command will not run in insert and visual mode.It will work in command mode. for command mode press ESC key then write below
##Automatic Indentation
Enable code indentation in vim
Disable code indentation in vim
###If you want by default vim load this above setting then write in your .vimrc file
like as we mention on above.
Adjusting and Correcting Indentation
###In general, ={motion} will align code to an indentation level.
S.N. | command | Work |
---|---|---|
1 | == | align the current line |
2 | =i{ | align the inner block |
3 | =% | align to the matching parenthesis/bracket under the cursor |
4 | =14j or 14== | align the next 14 lines |
5 | =G | align to the end of the file |
6 | vG= | same thing, align to the end of the file (but using visual mode) |
7 | vjjj= | align four lines (using visual mode) |
8 | gg=G | algin code in full file here = the indent command can take motions. So, By gg we go to the start of the file, = to indent and by G to the end of the file, gg=G |
Thanks!