|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 lujun9972 于 2012/7/29 14:17 编辑
- "===================================================================
- "其他设置
- set path+=./../inc/
- set backupdir=/tmp
- " Chinese
- "set encoding=utf-8
- "set langmenu=zh_CN.UTF-8
- "language message zh_CN.UTF-8
- set fileencodings=ucs-bom,utf-8,unicode,gb18030,cp936,big5,euc-jp,euc-kr,latin1
- " 设置在状态行显示的信息
- "set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ [%{(&fenc==""?&enc:&fenc).(&bomb?",BOM":"")}]\ %c:%l/%L%)\
- "设定PHP开发环境
- " php语法进行检测 ctrl+p启动
- map <C-P> :!/usr/bin/php -l %<CR>
- " php启动帮助 快捷键普通模式下K
- autocmd BufNewFile,Bufread *.ros,*.inc,*.php set keywordprg="help
- "设定VimOrganization插件
- au BufEnter *.org call org#SetOrgFileType()
- let g:org_todo_setup='TODO | DONE | DOING | CANCELED'
- "let g:org_tags_alist='{@home(h) @work(w) @tennisclub(t)} {easy(e) hard(d)} {computer(c) phone(p)}'
- "高亮光标所在行
- set cursorline
- "===================================================================
- " 设置文件的后缀与类型的关系
- autocmd BufReadPost *.src set filetype=ace
- autocmd BufReadPost *.sqc set filetype=c
- autocmd BufReadPost *.ec set filetype=c
- "When .vimrc is edited, reload it
- autocmd! bufwritepost _vimrc source $HOME/.vimrc
- "====================================================================
- "定义键缩写!!
- "set mapleader
- let mapleader=","
- " 定义下面的键映射,利用它可以在当前文件中快速查找光标下的单词,并打开窗口位置列表显示出来:
- nmap <leader>lv :lv /<c-r>=expand("<cword>")<cr>/ %<cr>:lw<cr>
- " 定义tag跳转命令
- " 定义pt,在预览窗口查看定义
- nmap pt <C-w>}<C-w>k
- nmap gt <C-]>
- "使用NERDTree插件查看工程文件。设置快捷键,速记法:file list
- nmap <Leader>fl :NERDTreeToggle<CR>
- nmap <leader>fe :Sexplore!<cr>
- "使用TagList插件查看工程文件。设置快捷键,速记法:tag list
- nmap <leader>tl :TlistToggle<cr>
- nmap <leader>wm :WMToggle<cr>
- nmap <leader>wa :WMToggle<cr>:NERDTreeToggle<CR>
- "搭建IDE的快捷键
- nmap <leader>save :call SaveProject()<CR>
- nmap <leader>wipe :call WipeProject()<CR>
- "设定自动生成tags
- "nmap <C-F12> :!ctags -a -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
- nmap <C-F12> :!ctags -a -R --fields=+iaS --extra=+q --exclude="project.vim" .<CR>
- "nmap <C-F12> :call RebuildTags()<CR>
- function! RebuildTags()
- if filereadable("./tags")
- delete("./tags")
- endif
- system("ctags -R --extra=+q --fields=+iaS .")
- endfunction
- "Fast reloading of the .vimrc
- nmap <leader>s :source $HOME/.vimrc<cr>
- "Fast editing of .vimrc
- nmap <silent> <leader>e :e $HOME/.vimrc<cr>
- "设置F3打开日历
- nmap <F3> :CalendarH<CR>
- "设置<C-c>为关闭窗口
- "nmap <C-c> :q<CR>
- nmap <C-c> :call MyQuit()<CR>
- "<C-F3>为取出<C-M>
- nmap <C-F3> :%s/<C-q><C-M>//g<CR>
- "设置,pj为打开关闭Project窗口
- nmap <silent> <Leader>pj <Plug>ToggleProject
- "设置F1
- inoremap <F1> <C-x><C-o>
- "设置窗口切换
- nnoremap <C-h> <C-w>h
- nnoremap <C-j> <C-w>j
- nnoremap <C-k> <C-w>k
- nnoremap <C-l> <C-w>l
- "====================================================================
- "插件配置
- "配置pathogen
- call pathogen#infect()
- "LookupFile setting
- let g:LookupFile_DisableDefaultMap = 1
- nmap <unique> <silent> <F4> <Plug>LookupFile
- " netrw setting
- let g:netrw_winsize = 30
- "设置TagList
- "标签列表窗口显示或隐藏不影响整个gvim窗口大小
- let Tlist_Inc_Winwidth=0
- let Tlist_Show_One_File=1
- let Tlist_Exit_OnlyWindow=1
- "let Tlist_Use_SingleClick=1
- "不显示Menu
- let Tlist_Show_Menu=0
- "let Tlist_Use_Right_Window=1
- "let Tlist_Auto_Open=1
- "let Tlist_WinWidth=20
- "设置windowsmanager
- "let loaded_winmanager = 1
- let g:winManagerWindowLayout='BufExplorer|TagList'
- let g:winmanagerPos="right"
- "设置NERDTree子窗口宽度
- let NERDTreeWinSize=23
- "设置NERDTree子窗口位置
- let NERDTreeWinPos="left"
- "设置grep
- "nnoremap <silent> <F3> :Grep<CR>
- "设置自动补全
- filetype plugin indent on
- set completeopt=longest,menu,preview
- "设置代码折叠类型
- set foldmethod=syntax
- "启动vim时不要自动折叠代码
- set foldlevel=100
- "设置颜色方案
- if v:progname =~? "gvim"
- colorscheme evening
- endif
- "设置OmniCpp
- let OmniCpp_GlobalScopeSearch=1
- let OmniCpp_NamespaceSearch=2
- "设定calendar插件
- let g:calendar_datetime='statusline'
- "====================================================================
- "我的脚本
- " 设置mksession
- " 设置sessionoptions可以用在UNIX下
- set sessionoptions+=slash
- set sessionoptions+=unix
- " 设置sessionoptions使用相对路径
- set sessionoptions-=curdir
- set sessionoptions+=sesdir
- set sessionoptions-=blank
- "设置启动时自动退出时自动保存读取项目相关配置
- function! SaveProject()
- "不保存winManger窗口
- WMClose
- "不保存NERDTree窗口
- NERDTreeClose
- "不保存Tlist,如果有__Tag_List__,说明打开了Tlist,保存之前那么关闭Tlist
- if(bufexists("__Tag_List__")!=0)
- TlistClose
- endif
- echo "Saving ".s:curProjectSession
- execute 'mksession! '.s:curProjectSession
- echo "Saving ".s:curProjectInfo
- execute 'wviminfo! '.s:curProjectInfo
- endfunction
- function! AutoSaveProject()
- if(argc()==0 && (filereadable(s:curProjectSession) || filereadable(s:curProjectInfo)))
- call SaveProject()
- endif
- endfunction
- function! LoadProject()
- let s:curWorkDir=getcwd()
- let s:curProjectSession=s:curWorkDir."/project.vim"
- let s:curProjectInfo=s:curWorkDir."/project.viminfo"
- if(filereadable(s:curProjectSession))
- "echo "Loading ".s:curProjectSession
- execute 'source '.s:curProjectSession
- endif
- if(filereadable(s:curProjectInfo))
- "echo "Loading ".s:curProjectInfo
- execute 'rviminfo '.s:curProjectInfo
- endif
- endfunction
- function! AutoLoadProject()
- if(argc()==0)
- call LoadProject()
- endif
- endfunction
- function! WipeProject()
- if(delete(s:curProjectSession)==0)
- echo "Deleted ".s:curProjectSession
- " delete(s:curProjectSession)
- endif
- if(delete(s:curProjectInfo)==0)
- "echo "Deleted ".s:curProjectInfo
- endif
- endfunction
- autocmd VimEnter * call AutoLoadProject()
- autocmd VimLeave * call AutoSaveProject()
- "设定find的path变量
- function! MyFind()
- let oldPath=&path
- set path+=**
- let fileName=input("请输入要查找的文件名:")
- execute "find ".fileName
- let &path=oldPath
- endfunction
- nmap <F6> :call MyFind()<CR>
- "C-c 退出脚本
- function! MyQuit()
- if winbufnr(2)==-1
- if tabpagenr('
- )==1
- "只有一个tab页,则提示是否退出
- echo "请用:q退出"
- else
- close
- endif
- else
- quit
- endif
- endfunction
- "读取文件类型配置
- let s:myVimrcPath="~/.vim/myVimrc/"
- function LoadMyVimrc()
- let s:myVimrcPathFt=s:myVimrcPath.expand("%:e")."/"
- let s:myVimrcFilesFt=s:myVimrcPathFt."*.vim"
- echo glob(s:myVimrcFilesFt)
- let s:myVimrcFilesFtList=split(glob(s:myVimrcFilesFt))
- for s:myVimrcFileFt in s:myVimrcFilesFtList
- if executable(s:myVimrcFileFt)
- source s:myVimrcFileFt
- endif
- endfor
- endfunction
复制代码 |
|