Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1366334
  • 博文数量: 118
  • 博客积分: 3888
  • 博客等级: 中校
  • 技术积分: 2940
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-10 18:15
个人简介

一看二做三总结

文章分类

全部博文(118)

分类: LINUX

2014-09-09 11:06:34

配置文件路径: /etc/vim/vimrc
在文件尾有如下代码,所以我们只需要创建并编辑vim.local这个:

点击(此处)折叠或打开

  1. " Source a global configuration file if available
  2. if filereadable("/etc/vim/vimrc.local
  3.   source /etc/vim/vimrc.local
  4. endif
/etc/vim/vimrc.local中是个人定制的配置:

点击(此处)折叠或打开

  1. set nocompatible
  2. set nomodeline
  3. set
  4. set history=500
  5. set autoindent
  6. set smartindent
  7. set tabstop=4
  8. set shiftwidth=4
  9. set
  10. set
  11. set cindent
  12. set showmatch
  13. set guioptions-=T
  14. set vb t_vb=
  15. set hlsearch
  16. set noignorecase

  17. colorscheme desert
  18. set t_Co=256
  19. syntax enable
  20. syntax on
  21. set noswf
  22. set cursorline
  23. hi CursorLine cterm=NONE ctermbg=0
  24. hi PreProc ctermfg=4
  25. hi StringFont term=underline ctermfg=130 guifg=#ffa0a0
  26. hi link String StringFont
  27. hi Constant ctermfg=26
  28. hi search ctermbg=1

  29. """"""""""""""""""""""""""""""""""""""
  30. " Taglist (ctags)
  31. """""""""""""""""""""""""""""""""""""
  32. let Tlist_Show_One_File=1
  33. let Tlist_Exit_OnlyWindow=1
  34. let Tlist_Use_Right_Window=1
  35. let Tlist_Auto_Open=0
  36. map <silent> <F9> :TlistToggle<cr>

  37. """"""""""""""""""""""""""""""""""""""
  38. " Nerd Commenter
  39. """""""""""""""""""""""""""""""""""""
  40. let NERDShutUp=1
  41. filetype plugin on

  42. let g:neocomplcache_enable_at_startup = 1
  43. let g:neocomplcache_min_syntax_length = 3

  44. """"""""""""""""""""""""""""""""""""""
  45. " Nerd Tree
  46. """""""""""""""""""""""""""""""""""""
  47. map <F8> :NERDTreeToggle<CR>

  48. """"""""""""""""""""""""""""""""""""""
  49. " Cscope
  50. """""""""""""""""""""""""""""""""""""
  51. if filereadable("/etc/vim/cscope_maps.vim")
  52.     source /etc/vim/cscope_maps.vim
  53. endif
下面是cscope_maps.vim中的配置,与vim.local放到同一个目录下。当然不需要cscope就算了。还有别忘了安装cscope。

点击(此处)折叠或打开

  1. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  2. " CSCOPE settings for vim
  3. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  4. "
  5. " This file contains some boilerplate settings for vim's cscope interface,
  6. " plus some keyboard mappings that I've found useful.
  7. "
  8. " USAGE:
  9. " -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
  10. " 'plugin' directory in some other directory that is in your
  11. " 'runtimepath'.
  12. "
  13. " -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
  14. " your ~/.vimrc file (or cut and paste it into your .vimrc).
  15. "
  16. " NOTE:
  17. " These key maps use multiple keystrokes (2 or 3 keys). If you find that vim
  18. " keeps timing you out before you can complete them, try changing your timeout
  19. " settings, as explained below.
  20. "
  21. " Happy cscoping,
  22. "
  23. " Jason Duell jduell@alumni.princeton.edu 2002/3/7
  24. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


  25. " This tests to see if vim was configured with the '--enable-cscope' option
  26. " when it was compiled. If it wasn't, time to recompile vim...
  27. if has("cscope")

  28.     """"""""""""" Standard cscope/vim boilerplate

  29.     " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
  30.     set cscopetag

  31.     " check cscope for definition of a symbol before checking ctags: set to 1
  32.     " if you want the reverse search order.
  33.     set csto=0

  34.     " add any cscope database in current directory
  35.     if filereadable("cscope.out")
  36.         cs add cscope.out
  37.     " else add the database pointed to by environment variable
  38.     elseif $CSCOPE_DB != ""
  39.         cs add $CSCOPE_DB
  40.     endif

  41.     " show msg when any other cscope db added
  42.     set cscopeverbose


  43.     """"""""""""" My cscope/vim key mappings
  44.     "
  45.     " The following maps all invoke one of the following cscope search types:
  46.     "
  47.     " 's' symbol: find all references to the token under cursor
  48.     " 'g' global: find global definition(s) of the token under cursor
  49.     " 'c' calls: find all calls to the function name under cursor
  50.     " 't' text: find all instances of the text under cursor
  51.     " 'e' egrep: egrep search for the word under cursor
  52.     " 'f' file: open the filename under cursor
  53.     " 'i' includes: find files that include the filename under cursor
  54.     " 'd' called: find functions that function under cursor calls
  55.     "
  56.     " Below are three sets of the maps: one set that just jumps to your
  57.     " search result, one that splits the existing vim window horizontally and
  58.     " diplays your search result in the new window, and one that does the same
  59.     " thing, but does a vertical split instead (vim 6 only).
  60.     "
  61.     " I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's
  62.     " unlikely that you need their default mappings (CTRL-\'s default use is
  63.     " as part of CTRL-\ CTRL-N typemap, which basically just does the same
  64.     " thing as hitting 'escape': CTRL-@ doesn't seem to have any default use).
  65.     " If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all
  66.     " of these maps to use other keys. One likely candidate is 'CTRL-_'
  67.     " (which also maps to CTRL-/, which is easier to type). By default it is
  68.     " used to switch between Hebrew and English keyboard mode.
  69.     "
  70.     " All of the maps involving the macro use '^<cfile>$': this is so
  71.     " that searches over '#include <time.h>" return only references to
  72.     " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all
  73.     " files that contain 'time.h' as part of their name).


  74.     " To do the first type of search, hit 'CTRL-\', followed by one of the
  75.     " cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope
  76.     " search will be displayed in the current window. You can use CTRL-T to
  77.     " go back to where you were before the search.
  78.     "

  79.     nmap <C-\>s :cs find s <C-R>=expand("")<CR><CR>    
  80.     nmap <C-\>g :cs find g <C-R>=expand("")<CR><CR>    
  81.     nmap <C-\>c :cs find c <C-R>=expand("")<CR><CR>    
  82.     nmap <C-\>t :cs find t <C-R>=expand("")<CR><CR>    
  83.     nmap <C-\>e :cs find e <C-R>=expand("")<CR><CR>    
  84.     nmap <C-\>f :cs find f <C-R>=expand("")<CR><CR>    
  85.     nmap <C-\>i :cs find i ^<C-R>=expand("")<CR>$<CR>
  86.     nmap <C-\>d :cs find d <C-R>=expand("")<CR><CR>    


  87.     " Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
  88.     " makes the vim window split horizontally, with search result displayed in
  89.     " the new window.
  90.     "
  91.     " (Note: earlier versions of vim may not have the :scs command, but it
  92.     " can be simulated roughly via:
  93.     " nmap s :cs find s =expand("<cword>")    

  94.     nmap s :scs find s =expand("<cword>")    
  95.     nmap g :scs find g =expand("<cword>")    
  96.     nmap c :scs find c =expand("<cword>")    
  97.     nmap t :scs find t =expand("<cword>")    
  98.     nmap e :scs find e =expand("<cword>")    
  99.     nmap f :scs find f =expand("<cfile>")    
  100.     nmap i :scs find i ^=expand("<cfile>")$    
  101.     nmap d :scs find d =expand("<cword>")    


  102.     " Hitting CTRL-space *twice* before the search type does a vertical
  103.     " split instead of a horizontal one (vim 6 and up only)
  104.     "
  105.     " (Note: you may wish to put a 'set splitright' in your .vimrc
  106.     " if you prefer the new window on the right instead of the left

  107.     nmap <C-@><C-@>s :vert scs find s <C-R>=expand("")<CR><CR>
  108.     nmap <C-@><C-@>g :vert scs find g <C-R>=expand("")<CR><CR>
  109.     nmap <C-@><C-@>c :vert scs find c <C-R>=expand("")<CR><CR>
  110.     nmap <C-@><C-@>t :vert scs find t <C-R>=expand("")<CR><CR>
  111.     nmap <C-@><C-@>e :vert scs find e <C-R>=expand("")<CR><CR>
  112.     nmap <C-@><C-@>f :vert scs find f <C-R>=expand("")<CR><CR>    
  113.     nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("")<CR>$<CR>    
  114.     nmap <C-@><C-@>d :vert scs find d <C-R>=expand("")<CR><CR>


  115.     """"""""""""" key map timeouts
  116.     "
  117.     " By default Vim will only wait 1 second for each keystroke in a mapping.
  118.     " You may find that too short with the above typemaps. If so, you should
  119.     " either turn off mapping timeouts via 'notimeout'.
  120.     "
  121.     "set notimeout
  122.     "
  123.     " Or, you can keep timeouts, by uncommenting the timeoutlen line below,
  124.     " with your own personal favorite value (in milliseconds):
  125.     "
  126.     "set timeoutlen=4000
  127.     "
  128.     " Either way, since mapping timeout settings by default also set the
  129.     " timeouts for multicharacter 'keys codes' (like ), you should also
  130.     " set ttimeout and ttimeoutlen: otherwise, you will experience strange
  131.     " delays as vim waits for a keystroke after you hit ESC (it will be
  132.     " waiting to see if the ESC is actually part of a key code like <F1>).
  133.     "
  134.     "set ttimeout
  135.     "
  136.     " personally, I find a tenth of a second to work well for key code
  137.     " timeouts. If you experience problems and have a slow terminal or network
  138.     " connection, set it higher. If you don

阅读(3435) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~