[Reserved] vim configuration file

New profile vim vim ~ / .vimrc

" Do not use vi keyboard mode, but their vim 
the SET nocompatible

" syntax highlighting
the SET syntax = ON

" to remove the incorrect input voice prompts
the SET noeb

" in dealing with unsaved or read-only files, the pop-up to confirm
the SET Confirm The

" Automatic indent
SET autoindent
SET cindent

" width of the Tab key
SET. 4 TabStop =

" unified indent. 4
SET = softtabstop. 4
SET. 4 shiftwidth =

" No spaces instead of tabs
SET noexpandtab

" line and the beginning of the segment with tabs
smarttab the SET

" display line numbers
the SET number The

" history number of
the SET history = 1000

"Prohibit generate temporary file
the SET nobackup
the SET noswapfile

"Search ignores case
SET ignorecase

" search character highlighted by
SET hlsearch
SET incsearch

" Alternatively the line
SET gdefault

" coding set
SET. 8 ENC = UTF-
SET = UTF-fencs. 8, UCS-BOM, Shift-JIS, GB18030, GBK, GB2312 , cp936

" language setting
sET langmenu = zh_CN.UTF. 8-
sET helplang CN =

" content I display status line (including the file type and decode)
sET% = F. statusline R & lt% H% m%% W \ [% the FORMAT = {& FF}] \ [the TYPE =% the Y] \ [the POS =% L,% V] [% P %%] \% {the strftime (\ " % D /% m /% Y \ - \% H:% m \ " )}
" SET statusline = [% F.] R & lt% Y% m%%% * = [line:% L / L%, the Column: C%] [% P %%]

" always a status line
set laststatus = 2

" during editing, the display position of the cursor in the lower right status line
ruler A SET

" command line height (in the status line), the default is 1, here 2
SET = 2 cmdheight

" detect file type
filetype ON

" loading filetype widget
filetype plugin ON

" Loading certain file types associated reduction into the document
filetype indent ON

" to save the global variables
the SET viminfo + =!

" word with the following symbols are not to be divided wrap
the SET iskeyword + = _, $, @,%, #, -

" inter-character insert the number of pixel rows
set linespace = 0

" enhanced mode command line automatically operating
SET wildmenu

" make backspace (backspace) normal processing indent, eol, start other
SET backspace = 2

" allows the backspace and cursor keys across row boundaries
set whichwrap + = <,>, h, L

"The mouse can be used anywhere in the buffer (similar to double-clicking the mouse is positioned at office work area)
"SET A = Mouse
"The SET Selection = exclusive
" the SET selectmode = Mouse, Key

" by using the: commands command, tell us which line of the file is changed
the SET Report = 0

" start time does not show that aid children in Somalia prompted
the SET shortmess = ATI

" in divided between windows blank, easy to read
the SET fillchars = Vert: \, STL: \, stlnc: \

" highlight the matching brace
the SET showmatch

" matching brace highlighting the time (in tenths of a second)
the SET =. 5 matchtime

" cursor moves to the holding of the top and bottom 3 rows from buffer
SET scrolloff = 3

" provides a C program indenting automatically
SET smartindent

" only be detected in the following line number when the file types, plain text files do not show
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 to compile and run C programs, F6 to compile and run C ++ programs
, " Please note that the use of the following codes in the windows will complain
" need removed./and two characters

" C's compile and run
map <the F5>: Call CompileRunGcc () <CR>
! CompileRunGcc FUNC ()
Exec " W "
Exec " GCC -o%% <! "
Exec " ./% <! "
ENDFUNC

" C ++ compiler and run
map <F6>: Call CompileRunGpp () <CR>
! CompileRunGpp FUNC ()
Exec
" W "
exec
"!g++ % -o %<"
exec
"! ./%<"
endfunc

" 能够漂亮地显示.NFO文件
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()

" 高亮显示普通txt文件(需要txt.vim脚本)
au BufRead,BufNewFile * setfiletype txt

"Spacebar to switch folding
set foldenable
set foldmethod=manual
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>

" minibufexpl插件的一般设置
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

"Change the color of the comment
hi Comment ctermfg=6 

Reprinted from: http://hi.chinaunix.net/?uid-591145-action-viewspace-itemid-20900

Reproduced in: https: //www.cnblogs.com/Leon5/archive/2011/10/08/2202468.html

Guess you like

Origin blog.csdn.net/weixin_34233679/article/details/93948131