프로그램

vi vim advanced options

mulderu 2014. 6. 9. 10:42


vi vim 사용중 가장 기억하지 못하는 것들이 set 옵션들이다.

그래서 갈무리 해 둡니다...

원본 : http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html

Vi/Vim modes:

Vi/Vim modes are set using the "set" command and its many options.

:set all - display all mode settings of your editing session. 
:set termcap - display terminal settings of your editing session.

:set ic - Change default to ignore case for text searches
Default is changed from noignorecase to ignorecase. (ic is a short form otherwise type set ignorecase)

Common options to set: 

Full "set" CommandShort formDescription
:set autoindent
:set noautoindent
:set ai
:set noai
{CR} returns to indent of previous line. 
Turn on autoindent: :set ai 
Turn off autoindent: :set noai 
Set indent width: set shiftwidth=4 
Intelligent auto-indent: set smartindent 
Toggle autoindent on/off when pasting text (press F2 key to toggle mode after one is in "insert" mode): set pastetoggle=<F2>
:set autowrite
:set noautowrite
:set aw
:set noaw
This tells vim to automatically write the file when switching to edit another file. See tags, editing multiple files (next, rewind)
:set backspace=indent,eol,start
:set backspace
:set bs=indent,eol,start
:set bs
Allow backspacing over an indent, line break (end of line) or start of an insert
:set backup=on
:set backup=off
:set bk=on
:set bk=off
Create backup file of file changes while editing. 
To automatically remove the backup file after the file being edited is written, use the option:set writebackup=on/off 
File backup mode settings: :set backupcopy=yes/no/auto
:set cryptmethod=zip
:set cryptmethod=blowfish
 Set file encryption for file save of buffer contents.
  • zip: pkzip
  • blowfish: strong encryption
This is set upon reading a file if encrypted.
Vim 7.3+
:set errorbells
:set noerrorbells
:set eb
:set noeb
Silence error beep
:set flash
:set noflash
:set fl
:set nofl
Screen flashes upon error (for deaf people or when noerrorbells is set)
:set tabstop=8:set tsTab key displays 8 spaces
:set ignorecase
:set noignorecase
:set ic
:set noic
Case sensitive searches
:set number
:set nonumber
:set nu
:set nonu
Display line numbers
:set showmatch
:set noshowmatch
no abbreviationsCursor shows matching ")" and "}"
:set showmode
:set noshowmode
no abbreviationsEditor mode is displayed on bottom of screen
:set showmatch
:set noshowmatch
no abbreviationsCursor shows matching ")" and "}"
:set syntax on
:set syntax off
no abbreviationsSet syntax highlighting and color highlighting for a file type (eg XML, HTML, C++, Java, etc). Also cursor shows matching ")" and "}"
Also can set syntax highlighting explicitly: :set syntax=html
Syntax definition files: /usr/share/vim/vim73/syntax/
:set taglength:set tlDefault=0. Set significant characters
:set closepunct='".,;)]}
% key shows matching symbol.
Also see showmatch
:set linelimit=1048560
Maximum file size to edit
:set wrapscan
:set nowrapscan
:set ws
:set nows
Breaks line if too long
:set wrapmargin=0
:set wrapmargin=8
:set nowrapmargin
:set wm
 
:set nowm
Define right margin for line wrapping.
Wrap when past 8 characters from the edge of column display (often default 80).
:set list
:set nolist

Display all Tabs and Ends of lines (Dislays these hidden characters).
:set bg=dark
:set bg=light

VIM: choose color scheme for "dark" or "light" console background.
See full list of set options