热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

vimrc配置史上最牛

http:amix.dkvimvimrc.html我了个去真强大另附一个vimrcvim:shiftwidth2:tabstop8:expandtabifhas(autocmd)
http://amix.dk/vim/vimrc.html  我了个去 真强大


另附一个vimrc

" vim:shiftwidth=2:tabstop=8:expandtabif has('autocmd')" Remove ALL autocommands for the current groupau!" Mark .asm files MASM-type assemblyau BufNewFile,BufReadPre *.asm let b:asmsyntax='masm'
endifif has('gui_running')let do_syntax_sel_menu=1
endifif has('gui_running') && $LANG !~ '\.'set encoding=utf-8
endifset nocompatible
source $VIMRUNTIME/vimrc_example.vimset autoindent
set nobackup
set showmatch
set formatoptions+=mM
set fileencodings=ucs-bom,utf-8,gbk
set statusline&#61;%<%f\ %h%m%r%&#61;%k[%{(&fenc&#61;&#61;\"\")?&enc:&fenc}%{(&bomb?\",BOM\":\"\")}]\ %-14.(%l,%c%V%)\ %P
if has(&#39;mouse&#39;)set mouse&#61;a
endif
if has(&#39;multi_byte&#39;) && v:version > 601if v:lang &#61;~? &#39;^\(zh\)\|\(ja\)\|\(ko\)&#39;set ambiwidth&#61;doubleendif
endif" Key mappings to ease browsing long lines
noremap gj
noremap gk
noremap gj
noremap gk
inoremap gj
inoremap gk" Key mappings for quick arithmetic inside Vim
nnoremap ma yypV:!calcu &#39;"&#39;k$
vnoremap ma yopV:!calcu &#39;"&#39;k$
nnoremap mr yyV:!calcu &#39;"&#39;$
vnoremap mr ygvmaomb:r !calcu &#39;"&#39;"ay$dd&#96;bv&#96;a"ap" Key mapping to stop the search highlight
nmap :nohlsearch
imap :nohlsearch" Key mapping for the taglist.vim plugin
nmap :Tlist
imap :Tlist" Key mappings for the quickfix commands
nmap :cn
nmap :cp" Non-GUI setting
if !has(&#39;gui_running&#39;)" Do not increase the windows width in the taglist.vim pluginif has(&#39;eval&#39;)let Tlist_Inc_Winwidth&#61;0endif" Set text-mode menuif has(&#39;wildmenu&#39;)set wildmenuset cpoptions-&#61;nmap :emenu imap :emenu endif
endifif has(&#39;autocmd&#39;)function! SetFileEncodings(encodings)let b:my_fileencodings_bak&#61;&fileencodingslet &fileencodings&#61;a:encodingsendfunctionfunction! RestoreFileEncodings()let &fileencodings&#61;b:my_fileencodings_bakunlet b:my_fileencodings_bakendfunctionfunction! CheckFileEncoding()if &modified && &fileencoding !&#61; &#39;&#39;exec &#39;e! &#43;&#43;enc&#61;&#39; . &fileencodingendifendfunctionfunction! ConvertHtmlEncoding(encoding)if a:encoding &#61;&#61;? &#39;gb2312&#39;return &#39;gbk&#39; " GB2312 imprecisely means GBK in HTMLelseif a:encoding &#61;&#61;? &#39;iso-8859-1&#39;return &#39;latin1&#39; " The canonical encoding name in Vimelseif a:encoding &#61;&#61;? &#39;utf8&#39;return &#39;utf-8&#39; " Other encoding aliases should follow hereelsereturn a:encodingendifendfunctionfunction! DetectHtmlEncoding()if &filetype !&#61; &#39;html&#39;returnendifnormal m&#96;normal ggif search(&#39;\c&#39;) !&#61; 0let reg_bak&#61;&#64;"normal y$let charset&#61;matchstr(&#64;", &#39;text/html; charset&#61;\zs[-A-Za-z0-9_]\&#43;&#39;)let charset&#61;ConvertHtmlEncoding(charset)normal &#96;&#96;let &#64;"&#61;reg_bakif &fileencodings &#61;&#61; &#39;&#39;let auto_encodings&#61;&#39;,&#39; . &encoding . &#39;,&#39;elselet auto_encodings&#61;&#39;,&#39; . &fileencodings . &#39;,&#39;endifif charset !&#61;? &fileencoding &&\(auto_encodings &#61;~ &#39;,&#39; . &fileencoding . &#39;,&#39; || &fileencoding &#61;&#61; &#39;&#39;)silent! exec &#39;e &#43;&#43;enc&#61;&#39; . charsetendifelsenormal &#96;&#96;endifendfunctionfunction! GnuIndent()setlocal cinoptions&#61;>4,n-2,{2,^-2,:2,&#61;2,g0,h2,p5,t0,&#43;2,(0,u0,w1,m1setlocal shiftwidth&#61;2setlocal tabstop&#61;8endfunctionfunction! RemoveTrailingSpace()if $VIM_HATE_SPACE_ERRORS !&#61; &#39;0&#39; &&\(&filetype &#61;&#61; &#39;c&#39; || &filetype &#61;&#61; &#39;cpp&#39; || &filetype &#61;&#61; &#39;vim&#39;)normal m&#96;silent! :%s/\s\&#43;$//enormal &#96;&#96;endifendfunction" Highlight space errors in C/C&#43;&#43; source files (Vim tip #935)if $VIM_HATE_SPACE_ERRORS !&#61; &#39;0&#39;let c_space_errors&#61;1endif" Use Canadian spelling convention in engspchk (Vim script #195)let spchkdialect&#61;&#39;can&#39;" Show syntax highlighting attributes of character under cursor (Vim" script #383)map a :call SyntaxAttr()" Automatically find scripts in the autoload directoryau FuncUndefined * exec &#39;runtime autoload/&#39; . expand(&#39;&#39;) . &#39;.vim&#39;" File type related autosettingau FileType c,cpp setlocal cinoptions&#61;:0,g0,(0,w1 shiftwidth&#61;4 tabstop&#61;4au FileType diff setlocal shiftwidth&#61;4 tabstop&#61;4au FileType html setlocal autoindent indentexpr&#61;au FileType changelog setlocal textwidth&#61;76" Text file encoding autodetectionau BufReadPre *.gb call SetFileEncodings(&#39;gbk&#39;)au BufReadPre *.big5 call SetFileEncodings(&#39;big5&#39;)au BufReadPre *.nfo call SetFileEncodings(&#39;cp437&#39;)au BufReadPost *.gb,*.big5,*.nfo call RestoreFileEncodings()au BufWinEnter *.txt call CheckFileEncoding()" Detect charset encoding in an HTML fileau BufReadPost *.htm* nested call DetectHtmlEncoding()" Recognize standard C&#43;&#43; headersau BufEnter /usr/include/c&#43;&#43;/* setf cppau BufEnter /usr/include/g&#43;&#43;-3/* setf cpp" Setting for files following the GNU coding standardau BufEnter /usr/* call GnuIndent()" Remove trailing spaces for C/C&#43;&#43; and Vim filesau BufWritePre * call RemoveTrailingSpace()
endif


转载于:https://www.cnblogs.com/zhihaowang/archive/2011/01/07/10128591.html


推荐阅读
author-avatar
aijunli2502898197
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有