indentation

basics

press v to enter selection mode, then…

indent

  • indent by default configuration: >
  • indent 4 spaces: 4 >

unindent

  • unindent by default configuration: <
  • unindent 4 spaces: 4 <

indent selected lines

  • use v command to enter select mode, select lines you want to indent
  • indent selected lines: j j >

v j j >

indent particular lines

Example is set to 5 lines

5 > >

references

format code

configure indent size

add configurations to ~/.vimrc

~/.vimrc
1
2
3
4
:set shiftwidth=2
:set autoindent
:set smartindent
:set tabstop=2

command

g g = G

references