技术员博客      html  css  js  c++  java
  • 贴个自个用的vimrc zmlovelx(帅得不敢出门 c/c++群31843264) 博客频道 CSDN.NET

    贴个自个用的vimrc - zmlovelx(帅得不敢出门 c/c++群31843264) - 博客频道 - CSDN.NET

    贴个自个用的vimrc

    分类: Vim 151人阅读 评论(0) 收藏 举报
    1. "~/.vimrc(configurationfileforvimonly)
    2. setfileencodings=utf-8,gb2312,gbk,gb18030
    3. settermencoding=utf-8
    4. "vundlebegin插件管理
    5. filetypeoff"required!
    6. setrtp+=~/.vim/bundle/vundle/
    7. callvundle#rc()
    8. "letVundlemanageVundle
    9. "required!
    10. Bundle'gmarik/vundle'
    11. "vim-scriptsrepos
    12. Bundle'STL-improved'
    13. Bundle'taglist.vim'
    14. Bundle'tag_in_new_tab'
    15. Bundle'autoload_cscope.vim'
    16. Bundle'CmdlineComplete'
    17. Bundle'xptemplate'
    18. Bundle'neocomplcache'
    19. Bundle'genutils'
    20. Bundle'lookupfile'
    21. Bundle'autopreview'
    22. Bundle'echofunc.vim'
    23. Bundle'grep.vim'
    24. Bundle'a.vim'
    25. Bundle'The-NERD-Commenter'
    26. Bundle'The-NERD-tree'
    27. Bundle'Source-Explorer-srcexpl.vim'
    28. Bundle'trinity.vim'
    29. "underlinuxneedexec'dos2unix~/.vim/bundle/QFixToggle/plugin/qfixtoggle.vim'
    30. Bundle'QFixToggle'
    31. Bundle'Color-Sampler-Pack'
    32. Bundle'txt.vim'
    33. Bundle'mru.vim'
    34. Bundle'Align'
    35. Bundle'DoxygenToolkit.vim'
    36. Bundle'headerGatesAdd.vim'
    37. Bundle'ShowMarks'
    38. "nongithubrepos
    39. "autocomplete.match.pair.vim,这个安装完必须在.vim/bundle/449512/目录下创建plugin目录并在其下创建软链接指向autocomplete.match.pair.vim,否则不工作,另外不知为何(号不会自动完成配对
    40. Bundle'git://gist.github.com/449512.git'
    41. "...
    42. filetypepluginindenton"required!
    43. "vundleend
    44. colorschemedesert
    45. synon"显高亮
    46. "setruler"屏幕右下角显示当前光标所处位置
    47. setlaststatus=2"alwayshavestatus-line'
    48. setstatusline=%F%m%r%h%w\%{&ff}\%Y\[ascii:%b\hex:0x\%02.2B]\[%{(&fenc\==\\"\"?&enc:&fenc).(&bomb?\",BOM\":\"\")}]\%=%l/%L,%v\%p%%
    49. setnumber
    50. setautochdir"自动切换当前目录为当前文件所在的目录
    51. setautoread"文件被其他程序修改时自动载入
    52. "Linesfolding
    53. "setfoldenable
    54. "setfoldnestmax=1
    55. "setfoldmethod=syntax
    56. "setfoldlevel=1
    57. "allowbackspacingovereverythingininsertmode
    58. setbackspace=indent,eol,start
    59. setshiftwidth=4
    60. settabstop=4
    61. setsofttabstop=4
    62. setexpandtab
    63. setlist"显示Tab符,使用一高亮竖线代替
    64. setlistchars=tab:\|\,
    65. "http://vimcdoc.sourceforge.net/doc/indent.html
    66. "g0类的public顶格写
    67. ":0将case标号放在switch()缩进位置之后的N个字符处
    68. "N-snamespace下顶格
    69. "(0条件语句多个条件在不同行时下一行与上一行对齐
    70. setcinoptions=g0,:0,N-s,(0
    71. setautoindent
    72. setsmartindent
    73. "setmouse=a
    74. setmps+=<:>"让<>可以使用%跳转
    75. sethid"allowtochangebufferwithoutsaving
    76. setshortmess=atI"shortensmessagestoavoid'pressakey'prompt
    77. setlazyredraw"donotredrawwhileexecutingmacros(muchfaster)
    78. "SetNumberformattonull(defaultisoctal),whenpressCTRL-Aonnumber
    79. "like007,itwouldnotbecome010
    80. setnf=
    81. "InVisualBlockMode,cursorcanbepositionedwherethereisnoactualcharacter
    82. setve=block
    83. setignorecase"Setsearch/replacepatterntoignorecase
    84. setsmartcase"Setsmartcasemodeon,Ifthereisuppercasecharacterinthesearchpatern,the'ignorecase'optionwillbeoverride.
    85. setshowcmd"displayincompletecommands
    86. setincsearch"doincrementalsearching
    87. sethlsearch"highlightsearch
    88. setmagic"Enablemagicmatching
    89. setshowmatch"showmatchingparen
    90. setwildmenu"增强模式中的命令行自动完成操作
    91. "Autochangetherootdirectory
    92. letNERDTreeChDirMode=2
    93. letg:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
    94. letg:DoxygenToolkit_blockFooter="--------------------------------------------------------------------------"
    95. letg:DoxygenToolkit_authorName="帅得不敢出门c++群31843264"
    96. letg:DoxygenToolkit_versionString="0.1.00"
    97. letg:DoxygenToolkit_briefTag_funcName="yes"
    98. autocmdBufNewFile*.{h,hpp,c,cpp}DoxAuthor
    99. "<Space>keyatnormalmodel.
    100. "nnoremap<Space>i<Esc>l
    101. "Switchingbetweenbuffers.
    102. nnoremap<C-h><C-W>h
    103. nnoremap<C-j><C-W>j
    104. nnoremap<C-k><C-W>k
    105. nnoremap<C-l><C-W>l
    106. inoremap<C-h><Esc><C-W>h
    107. inoremap<C-j><Esc><C-W>j
    108. inoremap<C-k><Esc><C-W>k
    109. inoremap<C-l><Esc><C-W>l
    110. "SetUpandDownnon-linewise
    111. noremap<Up>gk
    112. noremap<Down>gj
    113. "useMetakey(Windows:Alt)tomovecursorininsertmode.
    114. "Note:ifsysteminstall"LingoesTranslator",
    115. "youwillneedchange/disabledhotkey.
    116. noremap!<M-j><Down>
    117. noremap!<M-k><Up>
    118. noremap!<M-h><left>
    119. noremap!<M-l><Right>
    120. setpastetoggle=<F2>
    121. "nnoremap<F2>:setinvnumbernumber?<CR>:setinvpastepaste?<CR>
    122. "imap<F2><C-O>:setinvpastepaste?<CR><C-O>:setinvnumbernumber?<CR>
    123. nnoremap<silent><F3>:Rgrep<CR>
    124. nnoremap<F6>:AutoPreviewToggle<CR>
    125. inoremap<F6><ESC>:AutoPreviewToggle<CR>i
    126. "Openandcloseallthethreepluginsonthesametime
    127. nmap<F8>:TrinityToggleAll<CR>
    128. "Openandclosethesrcexpl.vimseparately
    129. nmap<F7>:TrinityToggleSourceExplorer<CR>
    130. "Openandclosethetaglist.vimseparately
    131. nmap<F10>:TrinityToggleTagList<CR>
    132. "OpenandclosetheNERD_tree.vimseparately
    133. nmap<F11>:TrinityToggleNERDTree<CR>
    134. "--lookupfile--
    135. letg:LookupFile_MinPatLength=2"最少输入2个字符才开始查找
    136. letg:LookupFile_PreserveLastPattern=0"不保存上次查找的字符串
    137. "letg:LookupFile_PreservePatternHistory=1"保存查找历史
    138. letg:LookupFile_AlwaysAcceptFirst=1"回车打开第一个匹配项目
    139. letg:LookupFile_AllowNewFiles=0"不允许创建不存在的文件
    140. iffilereadable("./filenametags")"设置tag文件的名字
    141. letg:LookupFile_TagExpr='"./filenametags"'
    142. endif
    143. "--taglist--
    144. settags=tags;
    145. letTlist_Auto_Update=1
    146. "--cscope--
    147. letg:autocscope_menus=0
    148. "Usequickfixwindowtoshowcscoperesults
    149. setcscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-
    150. "'csto'被设为0,cscope数据库先被搜索,搜索失败的情况下在搜索标签文件
    151. "设定了'cscopetag',这样所有的:tag命令就会实际上调用:cstag。这包括:tag、Ctrl-]及vim-t。
    152. "结果是一般的tag命令不仅搜索由ctags产生的标签文件,同时也搜索cscope数据库,但是好像有bug,二者共存时有的无法搜索
    153. ifhas("cscope")
    154. setcsprg=/usr/bin/cscope
    155. "Usebothcscopeandctag
    156. setcscopetag
    157. "Showmsgwhencscopedbadded
    158. setcscopeverbose
    159. "Usecscopefordefinitionsearchfirst
    160. setcscopetagorder=0
    161. endif
    162. nmap<C-_>s:csfinds<C-R>=expand("<cword>")<CR><CR>
    163. nmap<C-_>g:csfindg<C-R>=expand("<cword>")<CR><CR>
    164. nmap<C-_>c:csfindc<C-R>=expand("<cword>")<CR><CR>
    165. nmap<C-_>t:csfindt<C-R>=expand("<cword>")<CR><CR>
    166. nmap<C-_>e:csfinde<C-R>=expand("<cword>")<CR><CR>
    167. nmap<C-_>f:csfindf<C-R>=expand("<cfile>")<CR><CR>
    168. nmap<C-_>i:csfindi^<C-R>=expand("<cfile>")<CR>{1}lt;CR>
    169. nmap<C-_>d:csfindd<C-R>=expand("<cword>")<CR><CR>
    170. "解决cscope与tag共存时ctrl+]有时不正常的bug
    171. nmap<C-]>:tj<C-R>=expand("<cword>")<CR><CR>
    172. "VimTip329:Amapforswappingwords
    173. "http://vim.sourceforge.net/tip_view.php?tip_id=
    174. "Thenwhenyouputthecursoronorinaword,press"\sw",and
    175. "thewordwillbeswappedwiththenextword.Thewordsmay
    176. "evenbeseparatedbypunctuation(suchas"abc=def").
    177. nnoremap<unique><silent><leader>sw"_yiw:s/\(\%#\w\+\)\(\W\+\)\(\w\+\)/\3\2\1/<cr><c-o>
    178. "DisableAutoComplPop.
    179. letg:acp_enableAtStartup=0
    180. "Useneocomplcache.
    181. letg:neocomplcache_enable_at_startup=1
    182. "Usesmartcase.
    183. letg:neocomplcache_enable_smart_case=1
    184. "Usecamelcasecompletion.
    185. letg:neocomplcache_enable_camel_case_completion=1
    186. "Useunderbarcompletion.
    187. letg:neocomplcache_enable_underbar_completion=1
    188. "Setminimumsyntaxkeywordlength.
    189. letg:neocomplcache_min_syntax_length=3
    190. letg:neocomplcache_lock_buffer_name_pattern='\*ku\*'
    191. letg:neocomplcache_enable_ignore_case=0
    192. "Definedictionary.
    193. letg:neocomplcache_dictionary_filetype_lists={
    194. \'default':'',
    195. \'vimshell':$HOME.'/.vimshell_hist',
    196. \'scheme':$HOME.'/.gosh_completions'
    197. \}
    198. "Definekeyword.
    199. if!exists('g:neocomplcache_keyword_patterns')
    200. letg:neocomplcache_keyword_patterns={}
    201. endif
    202. letg:neocomplcache_keyword_patterns['default']='\h\w*'
    203. "Recommendedkey-mappings.
    204. "<CR>:closepopupandsaveindent.
    205. inoremap<expr><CR>neocomplcache#smart_close_popup()."\<CR>"
    206. "<TAB>:completion.
    207. "inoremap<expr><TAB>pumvisible()?"\<C-n>":"\<TAB>"
    208. "<C-h>,<BS>:closepopupanddeletebackwordchar.
    209. inoremap<expr><C-h>neocomplcache#smart_close_popup()."\<C-h>"
    210. inoremap<expr><BS>neocomplcache#smart_close_popup()."\<C-h>"
    211. inoremap<expr><C-y>neocomplcache#close_popup()
    212. inoremap<expr><C-e>neocomplcache#cancel_popup()
    213. "Fastremovehighlightsearch
    214. nmap<silent><leader><cr>:noh<cr>
    215. "每行超过80个的字符用下划线标示
    216. auBufRead,BufNewFile*.asm,*.c,*.cpp,*.java,*.cs,*.sh,*.lua,*.pl,*.pm,*.py,*.rb,*.hs,*.vim2matchUnderlined/.\%81v/
    217. "超过80个的字符高亮
    218. "auBufWinEnter*letw:m1=matchadd('Search','\%<88v.\%>81v',-1)
    219. "auBufWinEnter*letw:m2=matchadd('ErrorMsg','\%>80v.\+',-1)
    220. "高亮显示txt需要txt.vim
    221. auBufRead,BufNewFile*setfiletypetxt
    222. "Restorethelastquitpositionwhenopenfile.
    223. autocmdBufReadPost*
    224. \ifline("'\"")>0&&line("'\"")<=line("{1}quot;)|
    225. \exe"normalg'\""|
    226. \endif
    227. "自动更新最后修改时间
    228. function!AutoUpdateTheLastUpdateInfo()
    229. lets:original_pos=getpos(".")
    230. lets:regexp="^\\s*\\([#\\\"\\*]\\|\\/\\/\\)\\s\\?[lL]ast\\([uU]pdate\\|[cC]hange\\):"
    231. lets:lu=search(s:regexp)
    232. ifs:lu!=0
    233. lets:update_str=matchstr(getline(s:lu),s:regexp)
    234. callsetline(s:lu,s:update_str.strftime("%Y-%m-%d%H:%M:%S",localtime()))
    235. callsetpos(".",s:original_pos)
    236. endif
    237. endfunction
    238. autocmdBufWritePost*.{h,hpp,c,cpp}callAutoUpdateTheLastUpdateInfo()
    239. autocmdBufNewFile*.{h,hpp,c,cpp}exec'callappend(0,"\/\/LastUpdate:".strftime("%Y-%m-%d%H:%M:%S",localtime()))'


    已经放到github上了地址是,以后将不再更新此贴,最新的可到git上查看

    https://github.com/tczengming/myvim/

    希望能给大家做一个参考。插件用bundle (也有人叫vundle)管理的,推荐大家使用bundle,插件安装升级很方便

    只要一个vimrc

    先安装bundle

    git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

    然后可下载我的.vimrc替换你的.vimrc

    git clonehttps://github.com/tczengming/myvim.git

    下载后用myvim/myvimrc替换你的.vimrc (可自行修改其内容)

    然后在vim中执行

    BundleInstall! 就可以自动地更新安装插件,不用再手动去网上一个个下最新包了。
    缷载插件 :BundleClean

    carlhuda/janus

    Janus: Vim Distribution

    This is a distribution of plug-ins and mappings for Vim, Gvim and MacVim.

    It is designed to provide minimal working environment using the most popular plug-ins and the most common mappings.

    The distribution is completely customisable using a ~/.vimrc.before and ~/.vimrc.after Vim RC files.

  • 相关阅读:
    [原创] jquery post 跨域 提交数据_Front_row的空间_百度空间
    Groovy 闭包深入浅出 终点就是起点 ITeye技术网站
    改进的冒泡排序算法
    【★更新★】高性能 Windows Socket 服务端与客户端组件(HPSocket v2.0.1 源代码及测试用例下载)
    Ubuntu下通过unixODBC连接MS SqlServer2005
    Android项目代码混淆(加密),添加混淆配置文件
    如何在 Windows Phone 的代码中创建应用程序栏
    之前 传闻已经的djblets竟是reviewboard团队整的
    java.lang.IllegalArgumentException: argument type mismatch解决方法 shinn613的专栏 博客频道 CSDN.NET
    [JavaScript]多个表单中文件上传网址的获得的代码示例
  • 原文地址:https://www.cnblogs.com/lexus/p/2754072.html
Copyright © 2011-2022 技术员博客