Vi/etc/vim/vimrc
Edit the following
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"General Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set default decoding
Set Fenc=utf-8
Set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
"Don't use VI's keyboard mode, but Vim's own
Set nocompatible
"Number of rows to be recorded in the history file
Set history=100
"When working with unsaved or read-only files, pop-up confirmation
Set confirm
"Share the Clipboard with Windows
Set clipboard+=unnamed
"Detect file Types
FileType on
"Load file type plug-in
FileType plugin on
"Loading related indentation files for a specific file type
FileType indent on
"Save Global variables
Set viminfo+=!
"Words with the following symbols are not separated by line breaks
Set iskeyword+=_,$,@,%,#,-
The syntax highlighting
Syntax on
"Highlight character so that it is not limited by 100 columns
: Highlight overlength ctermbg=red ctermfg=white guibg=red guifg=white
: Match overlength ' \%101v.* '
The status line Color
Highlight Statusline Guifg=slateblue Guibg=yellow
Highlight Statuslinenc Guifg=gray Guibg=white
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
The File Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Do not back up files (depending on your needs)
Set Nobackup
"Do not generate swap files and hide it when buffer is discarded."
Setlocal Noswapfile
Set Bufhidden=hide
The number of pixel lines inserted by the word putting
Set linespace=0
"Command-line auto-complete operation in enhanced mode
Set Wildmenu
"Shows the line number and column number where the cursor is located on the status line
Set ruler
Set rulerformat=%20 (%2*%<%f%=\%m%r\%3l\%c\%p%%%)
The height of the command line (under the status line), which defaults to 1, here is 2
Set cmdheight=2
"Make the Back bar (BACKSPACE) normal handling indent, EOL, start, etc.
Set backspace=2
"Allow backspace and cursor keys to span line boundaries
Set Whichwrap+=<,>,h,l
"You can use the mouse anywhere in the buffer (similar to the workspace in office, double-click the mouse to navigate)
Set Mouse=a
Set selection=exclusive
Set Selectmode=mouse,key
"When it starts, it doesn't show the tips for helping Somalia children.
Set Shortmess=ati
"By using: Commands command, tell us which line of the file has been changed
Set report=0
"Don't let vim make a nasty drip sound
Set Noerrorbells
"Display whitespace between split windows for easy reading
Set Fillchars=vert:\, Stl:\, Stlnc:\
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
The Search and match
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Highlight matching parentheses
Set Showmatch
"Matches the time of the parentheses highlighting (in a very second)
Set matchtime=5
"Ignore case when searching
Set ignorecase
"Do not highlight the sentence being searched (phrases)
Set Nohlsearch
"When searching, enter the words verbatim Fugauliang (similar to Firefox's search)
Set Incsearch
"Input: What should the set List command show?"
Set Listchars=tab:\|\, trail:.,extends:>,precedes:<,eol:$
"Keep 3 lines away when the cursor moves to the top and bottom of the buffer
Set scrolloff=3
"Do not blink
Set Novisualbell
"My status line displays the contents (including file type and decoding)
Set statusline=%f%m%r%h%w\ [format=%{&ff}]\ [type=%y]\ [pos=%l,%v][%p%%]\%{strftime (\ "%d/%m/%y\-\%H:%M\")}
"Always Show status lines
Set laststatus=2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Text formatting and typesetting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
The Automatic formatting
Set FORMATOPTIONS=TCRQN
"The indentation of the previous line, particularly for multiline annotations
Set Autoindent
"Provides automatic indentation for C programs
Set Smartindent
"Use C-style indentation
Set Cindent
The tab is 4
Set tabstop=4
"Unified Indentation is 4
Set softtabstop=4
Set shiftwidth=4
"Do not use spaces instead of tabs
Set Noexpandtab
"Don't Break the line
Set nowrap
Use tabs at the beginning of rows and segments
Set Smarttab
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"The setting of the Ctags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Sort by name
Let Tlist_sort_type = "name"
"Show window on the right
Let Tlist_use_right_window = 1
The compression method
Let Tlist_compart_format = 1
"If there's only one Buffer,kill window, kill the buffer.
Let Tlist_exist_onlywindow = 1
"Do not close other files of tags
Let Tlist_file_fold_auto_close = 0
"Do not show collapsed trees
Let Tlist_enable_fold_column = 0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Autocommands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Line numbers are displayed only when the following file types are detected, and normal text files are not displayed
If has ("Autocmd")
Autocmd FileType Xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby Set number
Autocmd FileType xml,html vmap <C-o> <ESC> ' <i<!--<ESC>o<ESC> ' >o-->
Autocmd FileType java,c,cpp,cs vmap <C-o> <ESC> ' <o/*<ESC> ' >o*/
Autocmd FileType Html,text,php,vim,c,java,xml,bash,shell,perl,python setlocal textwidth=100
Autocmd Filetype html,xml,xsl Source $VIMRUNTIME/plugin/closetag.vim
Autocmd Bufreadpost *
\ If line ("' \" ") > 0 && line (" ' \ "") <= Line ("$") |
\ exe "normal g ' \" "|
\ endif
endif "has (" Autocmd ")
"F5 compile and run C programs, F6 compile and run C + + programs
"Please note that the following code is used under Windows error
"Need to be removed."/These two characters
"C's compile and run
Map <F5>: Call COMPILERUNGCC () <CR>
func! COMPILERUNGCC ()
Exec "W"
Exec "!GCC%-O%<"
EXEC "! ./%<"
Endfunc
"Compilation and operation of C + +
Map <F6>: Call COMPILERUNGPP () <CR>
func! COMPILERUNGPP ()
Exec "W"
Exec "!g++%-O%<"
EXEC "! ./%<"
Endfunc
"To be able to display beautifully. NFO file
Set Encoding=utf-8
function! Setfileencodings (Encodings)
Let B:myfileencodingsbak=&fileencodings
Let &fileencodings=a:encodings
Endfunction
function! Restorefileencodings ()
Let &fileencodings=b:myfileencodingsbak
Unlet B:myfileencodingsbak
Endfunction
Au bufreadpre *.nfo call setfileencodings (' cp437 ') |set Ambiwidth=single
Au bufreadpost *.nfo call restorefileencodings ()
"Highlight normal TXT file (requires Txt.vim script)
Au bufread,bufnewfile * Setfiletype txt
"Use the SPACEBAR to switch folding
Set foldenable
Set Foldmethod=manual
Nnoremap <space> @= ((Line ('. ')) < 0)? ' Zc ': ' zo ') <CR>
"General settings for the MINIBUFEXPL plugin
Let G:minibufexplmapwindownavvim = 1
Let G:minibufexplmapwindownavarrows = 1
Let G:minibufexplmapctabswitchbufs = 1
Let G:minibufexplmodseltarget = 1
Note: direct copy can
You are welcome to make suggestions!
Linux (Debian) vim configuration