diff --git a/vim/ftplugin/cpp.vim b/vim/ftplugin/cpp.vim new file mode 100644 index 0000000..aa3db2e --- /dev/null +++ b/vim/ftplugin/cpp.vim @@ -0,0 +1 @@ +set tags+=~/.vim/systag diff --git a/vim/ftplugin/python.vim b/vim/ftplugin/python.vim new file mode 100644 index 0000000..e69de29 diff --git a/vim/vimrc b/vim/vimrc index b0945b1..fa4a515 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,10 +1,13 @@ -set nocompatible " be iMproved, required -filetype off " required - " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() +"注释插件 +Plugin 'scrooloose/nerdcommenter' + +" git 插件 +Plugin 'https://github.com/tpope/vim-fugitive.git' + Plugin 'https://github.com/plytophogy/vim-virtualenv.git' let g:virtualenv_directory = '/home/light/workspace/tens/' @@ -66,49 +69,35 @@ map 6 :b 6 map 7 :b 7 map 8 :b 8 map 9 :b 9 +map q :bd " ctags 配置 -map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f .tags . :TlistUpdate -imap :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f .tags . :TlistUpdate +map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=Python -f .tags . +imap :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages-force=Python -f .tags . set tags=tags set tags+=./.tags -set tags+=~/.vim/systags +"set tags+=~/.vim/systags +" ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/systags /usr/include /usr/local/include "set tags = -Plugin 'taglist.vim' +Plugin 'https://github.com/majutsushi/tagbar.git' "ctags 配置:F3快捷键显示程序中的各种tags,包括变量和函数等。 -map :TlistToggle -let Tlist_Ctags_Cmd="/usr/bin/ctags" -let Tlist_Use_Right_Window=1 -let Tlist_Show_One_File=1 -let Tlist_Exit_OnlyWindow=1 -let Tlist_WinWidt=25 +map :TagbarToggle +let g:tagbar_ctags_bin="/usr/bin/ctags" Plugin 'The-NERD-tree' "NERDTree 配置:F2快捷键显示当前目录树 map :NERDTreeToggle let NERDTreeWinSize=25 - call vundle#end() " required -filetype plugin indent on " required - -map ggVGY -map! ggVGY -map gg=G -" 选中状态下 Ctrl+c 复制 -vmap "+y - +" 在文件外修改时自动加载 set autoread -" quickfix模式 + +" make 项目 autocmd FileType c,cpp map :w:make -"代码补全 -set completeopt=preview,menu -"允许插件 -filetype plugin on -"共享剪贴板 -set clipboard=unnamed + "从不备份 set nobackup "make 运行 @@ -118,8 +107,6 @@ set autowrite set ruler " 打开状态栏标尺 set cursorline " 突出显示当前行 set magic " 设置魔术 -set guioptions-=T " 隐藏工具栏 -set guioptions-=m " 隐藏菜单栏 "set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\ " 设置在状态行显示的信息 set foldcolumn=0 @@ -129,7 +116,7 @@ set foldenable " 开始折叠 " 不要使用vi的键盘模式,而是vim自己的 set nocompatible " 语法高亮 -set syntax=on +syntax on " 去掉输入错误的提示声音 set noeb " 在处理未保存或只读文件的时候,弹出确认 @@ -175,6 +162,7 @@ set laststatus=2 set cmdheight=2 " 侦测文件类型 filetype on +set backspace=indent,eol,start " 载入文件类型插件 filetype plugin on " 为特定文件类型载入相关缩进文件 @@ -192,6 +180,8 @@ set backspace=2 " 允许backspace和光标键跨越行边界 set whichwrap+=<,>,h,l " 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位) +map ma :set mouse=a +map mc :set mouse=c set mouse=a set selection=exclusive set selectmode=mouse,key @@ -230,3 +220,22 @@ filetype plugin indent on set completeopt=longest,menu + +" 打开文件时返回编辑的光标地点 +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + + + +" Delete trailing white space on save, useful for some filetypes ;) +fun! CleanExtraSpaces() + let save_cursor = getpos(".") + let old_query = getreg('/') + silent! %s/\s\+$//e + call setpos('.', save_cursor) + call setreg('/', old_query) +endfun + +if has("autocmd") + autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee,*.vue :call CleanExtraSpaces() +endif +