vim配置

最近重拾vim,下定决心要好好学习一下vim了(不知道这次能坚持几天。。。)

基本配置,参考

http://blog.csdn.net/cbffyx/article/details/8998238  Vim IDE配置,详细教程

http://blog.csdn.net/wooin/article/details/1858917  手把手教你把Vim改装成一个IDE编程环境(图文)

全能补全

http://blog.csdn.net/g_brightboy/article/details/19498983

下载OmniCppComplete,

autoload/*    ->    ~/.vim/autoload/

doc/*    ->    ~/.vim/doc/

after/*    ->    ~/.vim/after/ 放到对应目录下(http://blog.csdn.net/g_brightboy/article/details/19498983)

出现错误:全能补全,找不到模式,查了一下http://blog.csdn.net/ordeder/article/details/17473105

需要重新生成一下tags

supertab按照吴垠博客中的设置

 

  project插件配置

http://www.cnblogs.com/eddy-he/archive/2012/09/08/2676326.html

 

  自动补全设置

http://blog.csdn.net/g_brightboy/article/details/19498983

 

  一键编译运行 http://www.oschina.net/code/snippet_574132_13351

  复制黏贴快捷键

map <C-c> "+y
map <C-v> "+p

附上vimrc配置代码

  1 source ~/.vim/bundles.vim
  2 
  3 " encoding dectection
  4 set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
  5 
  6 " enable filetype dectection and ft specific plugin/indent
  7 filetype plugin indent on
  8 
  9 " enable syntax hightlight and completion
 10 syntax on
 11 
 12 "--------
 13 " Vim UI
 14 "--------
 15 " color scheme
 16 set background=dark
 17 color candy
 18 set ruler " 显示标尺
 19 
 20 " highlight current line
 21 au WinLeave * set nocursorline nocursorcolumn
 22 au WinEnter * set cursorline cursorcolumn
 23 set cursorline cursorcolumn
 24 
 25 " search
 26 set incsearch
 27 "set highlight     " conflict with highlight current line
 28 set ignorecase
 29 set smartcase
 30 
 31 " editor settings
 32 set history=1000
 33 set nocompatible
 34 set nofoldenable                                                  " disable folding"
 35 set confirm                                                       " prompt when existing from an unsaved file
 36 set backspace=indent,eol,start                                    " More powerful backspacing
 37 set t_Co=256                                                      " Explicitly tell vim that the terminal has 256 colors "
 38 set mouse=a                                                       " use mouse in all modes
 39 set report=0                                                      " always report number of lines changed                "
 40 set nowrap                                                        " dont wrap lines
 41 set scrolloff=5                                                   " 5 lines above/below cursor when scrolling
 42 set number                                                        " show line numbers
 43 set showmatch                                                     " show matching bracket (briefly jump)
 44 set showcmd                                                       " show typed command in status bar
 45 set title                                                         " show file in titlebar
 46 set laststatus=2                                                  " use 2 lines for the status bar
 47 set matchtime=2                                                   " show matching bracket for 0.2 seconds
 48 set matchpairs+=<:>                                               " specially for html
 49 " set relativenumber
 50 
 51 " Default Indentation
 52 set autoindent
 53 set smartindent     " indent when
 54 set tabstop=4       " tab width
 55 set softtabstop=4   " backspace
 56 set shiftwidth=4    " indent width
 57 " set textwidth=79
 58 " set smarttab
 59 set expandtab       " expand tab to space
 60 
 61 autocmd FileType php setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=120
 62 autocmd FileType ruby setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=120
 63 autocmd FileType php setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=120
 64 autocmd FileType coffee,javascript setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=120
 65 autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=120
 66 autocmd FileType html,htmldjango,xhtml,haml setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=0
 67 autocmd FileType sass,scss,css setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=120
 68 
 69 " syntax support
 70 autocmd Syntax javascript set syntax=jquery   " JQuery syntax support
 71 " js
 72 let g:html_indent_inctags = "html,body,head,tbody"
 73 let g:html_indent_script1 = "inc"
 74 let g:html_indent_style1 = "inc"
 75 
 76 "-----------------
 77 " Plugin settings
 78 "-----------------
 79 " Rainbow parentheses for Lisp and variants
 80 let g:rbpt_colorpairs = [
 81     \ ['brown',       'RoyalBlue3'],
 82     \ ['Darkblue',    'SeaGreen3'],
 83     \ ['darkgray',    'DarkOrchid3'],
 84     \ ['darkgreen',   'firebrick3'],
 85     \ ['darkcyan',    'RoyalBlue3'],
 86     \ ['darkred',     'SeaGreen3'],
 87     \ ['darkmagenta', 'DarkOrchid3'],
 88     \ ['brown',       'firebrick3'],
 89     \ ['gray',        'RoyalBlue3'],
 90     \ ['black',       'SeaGreen3'],
 91     \ ['darkmagenta', 'DarkOrchid3'],
 92     \ ['Darkblue',    'firebrick3'],
 93     \ ['darkgreen',   'RoyalBlue3'],
 94     \ ['darkcyan',    'SeaGreen3'],
 95     \ ['darkred',     'DarkOrchid3'],
 96     \ ['red',         'firebrick3'],
 97     \ ]
 98 let g:rbpt_max = 16
 99 autocmd Syntax lisp,scheme,clojure,racket RainbowParenthesesToggle
100 
101 " tabbar
102 let g:Tb_MaxSize = 2
103 let g:Tb_TabWrap = 1
104 
105 hi Tb_Normal guifg=white ctermfg=white
106 hi Tb_Changed guifg=green ctermfg=green
107 hi Tb_VisibleNormal ctermbg=252 ctermfg=235
108 hi Tb_VisibleChanged guifg=green ctermbg=252 ctermfg=white
109 
110 " easy-motion
111 let g:EasyMotion_leader_key = '<Leader>'
112 
113 " Tagbar
114 let g:tagbar_left=1
115 let g:tagbar_width=30
116 let g:tagbar_autofocus = 1
117 let g:tagbar_sort = 0
118 let g:tagbar_compact = 1
119 " tag for coffee
120 if executable('coffeetags')
121   let g:tagbar_type_coffee = {
122         \ 'ctagsbin' : 'coffeetags',
123         \ 'ctagsargs' : '',
124         \ 'kinds' : [
125         \ 'f:functions',
126         \ 'o:object',
127         \ ],
128         \ 'sro' : ".",
129         \ 'kind2scope' : {
130         \ 'f' : 'object',
131         \ 'o' : 'object',
132         \ }
133         \ }
134 
135   let g:tagbar_type_markdown = {
136     \ 'ctagstype' : 'markdown',
137     \ 'sort' : 0,
138     \ 'kinds' : [
139         \ 'h:sections'
140     \ ]
141     \ }
142 endif
143 
144 " Nerd Tree
145 let NERDChristmasTree=0
146 let NERDTreeWinSize=30
147 let NERDTreeChDirMode=2
148 let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
149 " let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$',  '\~$']
150 let NERDTreeShowBookmarks=1
151 let NERDTreeWinPos = "right"
152 
153 " nerdcommenter
154 let NERDSpaceDelims=1
155 " nmap <D-/> :NERDComToggleComment<cr>
156 let NERDCompactSexyComs=1
157 
158 " ZenCoding
159 let g:user_emmet_expandabbr_key='<C-j>'
160 
161 " powerline
162 "let g:Powerline_symbols = 'fancy'
163 
164 " NeoComplCache
165 let g:neocomplcache_enable_at_startup=1
166 let g:neoComplcache_disableautocomplete=1
167 "let g:neocomplcache_enable_underbar_completion = 1
168 "let g:neocomplcache_enable_camel_case_completion = 1
169 let g:neocomplcache_enable_smart_case=1
170 let g:neocomplcache_min_syntax_length = 3
171 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
172 set completeopt-=preview
173 
174 imap <C-k> <Plug>(neocomplcache_snippets_force_expand)
175 smap <C-k> <Plug>(neocomplcache_snippets_force_expand)
176 imap <C-l> <Plug>(neocomplcache_snippets_force_jump)
177 smap <C-l> <Plug>(neocomplcache_snippets_force_jump)
178 
179 " Enable omni completion.
180 autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
181 autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
182 autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
183 autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
184 autocmd FileType c setlocal omnifunc=ccomplete#Complete
185 if !exists('g:neocomplcache_omni_patterns')
186   let g:neocomplcache_omni_patterns = {}
187 endif
188 let g:neocomplcache_omni_patterns.erlang = '[a-zA-Z]\|:'
189 
190 " SuperTab
191 " let g:SuperTabDefultCompletionType='context'
192 let g:SuperTabDefaultCompletionType = '<C-X><C-U>'
193 let g:SuperTabRetainCompletionType=2
194 
195 " ctrlp
196 set wildignore+=*/tmp/*,*.so,*.o,*.a,*.obj,*.swp,*.zip,*.pyc,*.pyo,*.class,.DS_Store  " MacOSX/Linux
197 let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
198 
199 " Keybindings for plugin toggle
200 nnoremap <F2> :set invpaste paste?<CR>
201 set pastetoggle=<F2>
202 nmap <F5> :TagbarToggle<cr>
203 nmap <F6> :NERDTreeToggle<cr>
204 nmap <F3> :GundoToggle<cr>
205 nmap <F4> :IndentGuidesToggle<cr>
206 nmap  <D-/> :
207 nnoremap <leader>a :Ack
208 nnoremap <leader>v V`]
209 
210 "------------------
211 " Useful Functions
212 "------------------
213 " easier navigation between split windows
214 nnoremap <c-j> <c-w>j
215 nnoremap <c-k> <c-w>k
216 nnoremap <c-h> <c-w>h
217 nnoremap <c-l> <c-w>l
218 
219 " When editing a file, always jump to the last cursor position
220 autocmd BufReadPost *
221       \ if ! exists("g:leave_my_cursor_position_alone") |
222       \     if line("'\"") > 0 && line ("'\"") <= line("$") |
223       \         exe "normal g'\"" |
224       \     endif |
225       \ endif
226 
227 " w!! to sudo & write a file
228 cmap w!! %!sudo tee >/dev/null %
229 
230 " Quickly edit/reload the vimrc file
231 nmap <silent> <leader>ev :e $MYVIMRC<CR>
232 nmap <silent> <leader>sv :so $MYVIMRC<CR>
233 
234 " sublime key bindings
235 nmap <D-]> >>
236 nmap <D-[> <<
237 vmap <D-[> <gv
238 vmap <D-]> >gv
239 
240 " eggcache vim
241 nnoremap ; :
242 :command W w
243 :command WQ wq
244 :command Wq wq
245 :command Q q
246 :command Qa qa
247 :command QA qa
248 
249 " for macvim
250 if has("gui_running")
251     set go=aAce  " remove toolbar
252     "set transparency=30
253     "set guifont=Bitstream\charter:12
254     set gfn=Bitstream\ Vera\ Sans\ Mono\ 30
255     set showtabline=2
256     set columns=140
257     set lines=40
258     noremap <D-M-Left> :tabprevious<cr>
259     noremap <D-M-Right> :tabnext<cr>
260     map <D-1> 1gt
261     map <D-2> 2gt
262     map <D-3> 3gt
263     map <D-4> 4gt
264     map <D-5> 5gt
265     map <D-6> 6gt
266     map <D-7> 7gt
267     map <D-8> 8gt
268     map <D-9> 9gt
269     map <D-0> :tablast<CR>
270 endif
271 
272   "--ctags setting--
273     " 按下F5重新生成tag文件,并更新taglist
274     map <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR> :TlistUpdate<CR>
275     imap <F5> <ESC>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR> :TlistUpdate<CR>
276     set tags=tags
277     set tags+=./tags "add current directory's generated tags file
278     set tags+=~/liuyanjie/code/tags "add new tags file(刚刚生成tags的路径,在ctags -R 生成tags文件后,不要将tags移动到别的目录,否则ctrl+]时,会提示找不到源码文件)
279 
280 
281  "-- Taglist setting --
282     let Tlist_Ctags_Cmd='ctags' "因为我们放在环境变量里,所以可以直接执行
283     let Tlist_Use_Right_Window=1 "让窗口显示在右边,0的话就是显示在左边
284     let Tlist_Show_One_File=0 "让taglist可以同时展示多个文件的函数列表
285     let Tlist_File_Fold_Auto_Close=1 "非当前文件,函数列表折叠隐藏
286     let Tlist_Exit_OnlyWindow=1 "当taglist是最后一个分割窗口时,自动推出vim
287     "是否一直处理tags.1:处理;0:不处理
288     let Tlist_Process_File_Always=1 "实时更新tags
289     let Tlist_Inc_Winwidth=0
290 
291 "默认打开Tlist
292  let Tlist_Auto_Open=1
293 
294 set tags=tags;
295 
296 
297  "-- WinManager setting --
298     let g:winManagerWindowLayout='FileExplorer|TagList' " 设置我们要管理的插件
299     "let g:persistentBehaviour=0 " 如果所有编辑文件都关闭了,退出vim
300     nmap wm :WMToggle<cr> 
301 
302 
303  " -- MiniBufferExplorer --
304     let g:miniBufExplMapWindowNavVim = 1 " 按下Ctrl+h/j/k/l,可以切换到当前窗口的上下左右窗口
305     let g:miniBufExplMapWindowNavArrows = 1 " 按下Ctrl+箭头,可以切换到当前窗口的上下左右窗口
306     let g:miniBufExplMapCTabSwitchBufs = 1 " 启用以下两个功能:Ctrl+tab移到下一个buffer并在当前窗口打开;Ctrl+Shift+tab移到上一个buffer并在当前窗口打开;ubuntu好像不支持
307     "let g:miniBufExplMapCTabSwitchWindows = 1 " 启用以下两个功能:Ctrl+tab移到下一个窗口;Ctrl+Shift+tab移到上一个窗口;ubuntu好像不支持
308     let g:miniBufExplModSelTarget = 1    " 不要在不可编辑内容的窗口(如TagList窗口)中打开选中的buffer
309 
310  "--fold setting 折叠设置--
311     set foldmethod=syntax " 用语法高亮来定义折叠
312     set foldlevel=100 " 启动vim时不要自动折叠代码
313     set foldcolumn=5 " 设置折叠栏宽度
314 
315 
316 "-- QuickFix setting --
317     " 按下F6,执行make clean
318     map <F6> :make clean<CR><CR><CR>
319     " 按下F7,执行make编译程序,并打开quickfix窗口,显示编译信息
320     map <F7> :make<CR><CR><CR> :copen<CR><CR>
321     " 按下F8,光标移到上一个错误所在的行
322     map <F8> :cp<CR>
323     " 按下F9,光标移到下一个错误所在的行
324     map <F9> :cn<CR>
325     " 以上的映射是使上面的快捷键在插入模式下也能用
326     imap <F6> <ESC>:make clean<CR><CR><CR>
327     imap <F7> <ESC>:make<CR><CR><CR> :copen<CR><CR>
328     imap <F8> <ESC>:cp<CR>
329     imap <F9> <ESC>:cn<CR>
330 
331 
332  "-- Cscope setting --
333     if has("cscope")
334         set csprg=/usr/bin/cscope        " 指定用来执行cscope的命令
335         set csto=0                        " 设置cstag命令查找次序:0先找cscope数据库再找标签文件;1先找标签文件再找cscope数据库
336         set cst                            " 同时搜索cscope数据库和标签文件
337         set cscopequickfix=s-,c-,d-,i-,t-,e-    " 使用QuickFix窗口来显示cscope查找结果
338         set nocsverb
339         if filereadable("cscope.out")    " 若当前目录下存在cscope数据库,添加该数据库到vim
340             cs add cscope.out
341         elseif $CSCOPE_DB != ""            " 否则只要环境变量CSCOPE_DB不为空,则添加其指定的数据库到vim
342             cs add $CSCOPE_DB
343         endif
344         set csverb
345     endif
346     map <F4> :cs add ./cscope.out .<CR><CR><CR> :cs reset<CR>
347     imap <F4> <ESC>:cs add ./cscope.out .<CR><CR><CR> :cs reset<CR>
348     " 将:cs find c等Cscope查找命令映射为<C-_>c等快捷键(按法是先按Ctrl+Shift+-, 然后很快再按下c)
349     nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> :copen<CR><CR>
350     nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
351     nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR> :copen<CR><CR>
352     nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR> :copen<CR><CR>
353     nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR> :copen<CR><CR>
354     nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR> :copen<CR><CR>
355     nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
356     nmap <C-_>i :cs find i <C-R>=expand("<cfile>")<CR><CR> :copen<CR><CR>
357 
358     "ew-omni-completion配置
359     filetype plugin indent on
360     set completeopt=longest,menu
361 
362     "supertab设置
363     let g:SuperTabRetainCompletionType=2
364     let g:SuperTabDefaultCompletionType="<C-X><C-O>"
365 
366 
367 
368 "------------------------------------------------------------------------------
369 "  < 判断操作系统是否是 Windows 还是 Linux >
370 "------------------------------------------------------------------------------
371 if(has("win32") || has("win64") || has("win95") || has("win16"))
372     let g:iswindows = 1
373 else
374     let g:iswindows = 0
375 endif
376  
377 "------------------------------------------------------------------------------
378 "  < 判断是终端还是 Gvim >
379 "------------------------------------------------------------------------------
380 if has("gui_running")
381     let g:isGUI = 1
382 else
383     let g:isGUI = 0
384 endif
385  
386 "------------------------------------------------------------------------------
387 "  < 编译、连接、运行配置 >
388 "------------------------------------------------------------------------------
389 " F9 一键保存、编译、连接存并运行
390 map <F9> :call Run()<CR>
391 imap <F9> <ESC>:call Run()<CR>
392  
393 " Ctrl + F9 一键保存并编译
394 map <c-F9> :call Compile()<CR>
395 imap <c-F9> <ESC>:call Compile()<CR>
396  
397 " Ctrl + F10 一键保存并连接
398 map <c-F10> :call Link()<CR>
399 imap <c-F10> <ESC>:call Link()<CR>
400  
401 let s:LastShellReturn_C = 0
402 let s:LastShellReturn_L = 0
403 let s:ShowWarning = 1
404 let s:Obj_Extension = '.o'
405 let s:Exe_Extension = '.exe'
406 let s:Sou_Error = 0
407  
408 let s:windows_CFlags = 'gcc\ -fexec-charset=gbk\ -Wall\ -g\ -O0\ -c\ %\ -o\ %<.o'
409 let s:linux_CFlags = 'gcc\ -Wall\ -g\ -O0\ -c\ %\ -o\ %<.o'
410  
411 let s:windows_CPPFlags = 'g++\ -fexec-charset=gbk\ -Wall\ -g\ -O0\ -c\ %\ -o\ %<.o'
412 let s:linux_CPPFlags = 'g++\ -Wall\ -g\ -O0\ -c\ %\ -o\ %<.o'
413  
414 func! Compile()
415     exe ":ccl"
416     exe ":update"
417     if expand("%:e") == "c" || expand("%:e") == "cpp" || expand("%:e") == "cxx"
418         let s:Sou_Error = 0
419         let s:LastShellReturn_C = 0
420         let Sou = expand("%:p")
421         let Obj = expand("%:p:r").s:Obj_Extension
422         let Obj_Name = expand("%:p:t:r").s:Obj_Extension
423         let v:statusmsg = ''
424         if !filereadable(Obj) || (filereadable(Obj) && (getftime(Obj) < getftime(Sou)))
425             redraw!
426             if expand("%:e") == "c"
427                 if g:iswindows
428                     exe ":setlocal makeprg=".s:windows_CFlags
429                 else
430                     exe ":setlocal makeprg=".s:linux_CFlags
431                 endif
432                 echohl WarningMsg | echo " compiling..."
433                 silent make
434             elseif expand("%:e") == "cpp" || expand("%:e") == "cxx"
435                 if g:iswindows
436                     exe ":setlocal makeprg=".s:windows_CPPFlags
437                 else
438                     exe ":setlocal makeprg=".s:linux_CPPFlags
439                 endif
440                 echohl WarningMsg | echo " compiling..."
441                 silent make
442             endif
443             redraw!
444             if v:shell_error != 0
445                 let s:LastShellReturn_C = v:shell_error
446             endif
447             if g:iswindows
448                 if s:LastShellReturn_C != 0
449                     exe ":bo cope"
450                     echohl WarningMsg | echo " compilation failed"
451                 else
452                     if s:ShowWarning
453                         exe ":bo cw"
454                     endif
455                     echohl WarningMsg | echo " compilation successful"
456                 endif
457             else
458                 if empty(v:statusmsg)
459                     echohl WarningMsg | echo " compilation successful"
460                 else
461                     exe ":bo cope"
462                 endif
463             endif
464         else
465             echohl WarningMsg | echo ""Obj_Name"is up to date"
466         endif
467     else
468         let s:Sou_Error = 1
469         echohl WarningMsg | echo " please choose the correct source file"
470     endif
471     exe ":setlocal makeprg=make"
472 endfunc
473  
474 func! Link()
475     call Compile()
476     if s:Sou_Error || s:LastShellReturn_C != 0
477         return
478     endif
479     let s:LastShellReturn_L = 0
480     let Sou = expand("%:p")
481     let Obj = expand("%:p:r").s:Obj_Extension
482     if g:iswindows
483         let Exe = expand("%:p:r").s:Exe_Extension
484         let Exe_Name = expand("%:p:t:r").s:Exe_Extension
485     else
486         let Exe = expand("%:p:r")
487         let Exe_Name = expand("%:p:t:r")
488     endif
489     let v:statusmsg = ''
490     if filereadable(Obj) && (getftime(Obj) >= getftime(Sou))
491         redraw!
492         if !executable(Exe) || (executable(Exe) && getftime(Exe) < getftime(Obj))
493             if expand("%:e") == "c"
494                 setlocal makeprg=gcc\ -o\ %<\ %<.o
495                 echohl WarningMsg | echo " linking..."
496                 silent make
497             elseif expand("%:e") == "cpp" || expand("%:e") == "cxx"
498                 setlocal makeprg=g++\ -o\ %<\ %<.o
499                 echohl WarningMsg | echo " linking..."
500                 silent make
501             endif
502             redraw!
503             if v:shell_error != 0
504                 let s:LastShellReturn_L = v:shell_error
505             endif
506             if g:iswindows
507                 if s:LastShellReturn_L != 0
508                     exe ":bo cope"
509                     echohl WarningMsg | echo " linking failed"
510                 else
511                     if s:ShowWarning
512                         exe ":bo cw"
513                     endif
514                     echohl WarningMsg | echo " linking successful"
515                 endif
516             else
517                 if empty(v:statusmsg)
518                     echohl WarningMsg | echo " linking successful"
519                 else
520                     exe ":bo cope"
521                 endif
522             endif
523         else
524             echohl WarningMsg | echo ""Exe_Name"is up to date"
525         endif
526     endif
527     setlocal makeprg=make
528 endfunc
529  
530 func! Run()
531     let s:ShowWarning = 0
532     call Link()
533     let s:ShowWarning = 1
534     if s:Sou_Error || s:LastShellReturn_C != 0 || s:LastShellReturn_L != 0
535         return
536     endif
537     let Sou = expand("%:p")
538     let Obj = expand("%:p:r").s:Obj_Extension
539     if g:iswindows
540         let Exe = expand("%:p:r").s:Exe_Extension
541     else
542         let Exe = expand("%:p:r")
543     endif
544     if executable(Exe) && getftime(Exe) >= getftime(Obj) && getftime(Obj) >= getftime(Sou)
545         redraw!
546         echohl WarningMsg | echo " running..."
547         if g:iswindows
548             exe ":!%<.exe"
549         else
550             if g:isGUI
551                 exe ":!gnome-terminal -e ./%<"
552             else
553                 exe ":!./%<"
554             endif
555         endif
556         redraw!
557         echohl WarningMsg | echo " running finish"
558     endif
559 endfunc
560 
561 
562 
563 map <C-A> ggVG$"+y  
564 map <C-v> "*pa  
565 imap <C-v> <Esc>"*pa
566 vmap <C-c> "+y
567 map <C-c> "+y
568 map <C-v> "+p
View Code

 

在eclipse中使用viplugin

部分快捷键冲突 

设置几个喜欢的快捷键,由于eclipse已经设置了这些快捷键,但我们在vi里使用习惯了,所以还需要自己设置为vi模式的快捷键,
方法是:Window --> Preferences --> Keys, 在Scheme里选择viPlugin, 对Category进行排序,找到Category是ViPlugin的几项,
我喜欢设置:(如果有冲突,则把其他项修改为其它快捷键)http://www.cppblog.com/binger/archive/2014/01/02/205122.html

转载于:https://www.cnblogs.com/vactor/p/4992599.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值