VI / VIM spaces modified Tab 4

Configuration

  1. Created or modified in the current user directory ~ / .vimrc
  2. Modify / etc the Root user / virc and / etc / vimrc
set ts=4
set softtabstop=4
set expandtab
set autoindent
set shiftwidth=4

Configuration Notes

  • ts is the abbreviation tabstop, the width is set TAB 4 spaces.
  • represents softtabstop press the backspace key when in the retracted length indented when the edit mode is particularly useful when used expandtab.
  • expandtab represented by spaces for indentation, noexpandtab is represented by a tab indentation.
  • autoindent automatic indentation
  • shiftwidth represents a length of each indentation is generally provided like softtabstop.

Extended summary

Recommendations Given the current user operation, so as not to contaminate other users to configure and use.

For comparison VI, VIM has a multi-level undo, ease of use, syntax highlighting, visual operation, on the VI is fully compatible.

Frequently used commands: vim fileName ( open file, if there is new ) ,: w ( save file ) ,: w tmp.txt ( save to tmp.txt ) ,: q ( quit !) ,: q ( force quit ) ,: wq ( save and exit ) ,: wq (! save and force quit )

Common operations: / search_key ( query ) ,: set nu ( display line number ) ,: set nonu ( hidden line number ) ,: s / older / new / ( replace the first line current ) ,: s / older / new / g ( Alternatively all the current row ) ,: s / older / new / gc ( the current line and ask all ),:% s / older / new / g ( Alternatively all the rows ), dd ( cursor to deleting rows ) ,: 1, nd ( deleting lines 1 to n ) ,: 2, $ d ( deleted to the end 2 ) ,: g / test / d ( find and remove the line containing the test ), u ( undo ), ctrl + r ( recovery withdrawn )

Guess you like

Origin www.cnblogs.com/isliwg/p/10978229.html