vimrc配置

"set short key to edit .vimrc
let mapleader=","
map <silent> <leader>vs :source ~/.vimrc<cr>
map <silent> <leader>ve :e ~/.vimrc<cr>
autocmd! bufwritepost .vimrc source ~/.vimrc

"set path
set path=.,/usr/include,,
if filereadable("workspace.vim")
 source workspace.vim
endif


set helplang=cn   "使用中文帮助文档
set encoding=utf-8  "查看utf-8格式的帮助文档
set fileencodings=gbk,utf8 "支持打开gbk格式的文件

colorscheme default
"colorscheme evening
"colorscheme desert   "设置窗口颜色
set guifont=Bitstream\ Vera\ Sans\ Mono\ 11 "设置字体为Bitstream Vera Sans Mono 9大小
set tabstop=4   "设置tab的跳数
set expandtab   "使用空格代替tab 在写Makefile时需要有tab
set backspace=2   "设置退格键可用
set number    "设置显示行号
"set wrap    "设置自动换行
set nowrap    "设置不自动换行
set linebreak   "整词换行,与自动换行搭配使用,效果很好
set whichwrap=b,s,<,>,[,] "光标可以从行首和行尾跳到另一行去
"set list    "显示制表符
"set listchars=tab:.\ ,trail:. "将制表符显示为'.   '
set autochdir   "自动设置当前目录为正在编辑的目录
set hidden    "自动隐藏"没有保存的缓冲区,切换buffer时不给出保存当前buffer的提示
set scrolloff=5   "在光标接近底端或顶端时,自动下滚或上滚.
set mouse=a    "在命令行启用鼠标

"========================================================================================================
"查找/替换相关的设置
"========================================================================================================
set hlsearch   "高亮显示查找结果
set incsearch   "增量查找
set gdefault   "替换时,使用g标签成为默认设置. 在替换时,替换本行所有符合的匹配
"========================================================================================================
"状态栏的设置
"========================================================================================================
set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%] "显示文件名: 总行数, 总的字符数
set ruler    "在编辑过程中, 在右下角显示光标位置的状态行
"========================================================================================================
"设置C++开发环境
"========================================================================================================
syntax enable   "打开语法高亮
syntax on    "打开语法高亮
      "在.vim/syntax/c.vim文件中设置了运算符,函数名等高亮
set showmatch   "设置匹配模式, 相当于括号匹配
set smartindent   "智能对齐
set shiftwidth=4  "换行时,交错使用4个空格
set autoindent   "设置自动对齐
set ai!     "设置自动缩进

"--------------------------------------------------------------------------------------------------------
"代码折叠
"--------------------------------------------------------------------------------------------------------

"--------------------------------------------------------------------------------------------------------
"窗口操作的快捷键
"--------------------------------------------------------------------------------------------------------
"垂直分割当前窗口
nmap <silent> <leader>wv <C-w>v
"关闭当前窗口
nmap <silent> <leader>wc <C-w>c
"水平分割当前窗口
nmap <silent> <leader>ws <C-w>s

"--------------------------------------------------------------------------------------------------------
"插件配置
"--------------------------------------------------------------------------------------------------------

"TList
let Tlist_Show_One_File=1  "设置只显示1个文件的tag
let Tlist_Exit_OnlyWindow=1  "设置Tlist在只显示Tlist窗口时退出vim
let Tlist_Use_Right_Window=1 "设置Tlist在右侧显示
let Tlist_Sort_Type="name"  "设置按名称排序
"映射Tlist的快捷键,打开列表
nmap <silent> <leader>t :Tlist<cr> 

"DrawIt
"nmap <silent> <leader>di :DIstart<cr>
"nmap <silent> <leader>ds :DIstart<cr>

"NERDTree
"映射NERDTreeToggle的快捷键 "打开当前目录
nmap <silent> <leader>p :NERDTreeToggle .<cr>

"cscope
"set cscopequickfix=s-,c-,d-,i-,t-,e- "设定使用quickfix窗口来显示cscope的结果
cs a ./cscope.out
"查找定义, <C-t>跳回
nmap <silent> <leader>sg :cs find g <C-R>=expand("<cword>")<CR><CR> 
"查找调用本函数的函数
nmap <silent> <leader>sc :cs find c <C-R>=expand("<cword>")<CR><CR>
"查找本函数调用的函数
nmap <silent> <leader>sd :cs find d <C-R>=expand("<cword>")<CR><CR>
"查找本字符串
nmap <silent> <leader>st :cs find t <C-R>=expand("<cword>")<CR><CR>
"查找本egrep模式
nmap <silent> <leader>se :cs find e <C-R>=expand("<cword>")<CR><CR>
"查找包含本文件的文件
nmap <silent> <leader>si :cs find i <C-R>=expand("<cfile>")<CR>$<CR> 

"映射QuickFix的快捷键
"打开quickfix窗口
nmap <silent> <F7> :cw<cr>
"前一项
nmap <silent> <F8> :cn<cr>
"后一项
nmap <silent> <F9> :cp<cr>

"映射窗口间移动快捷键
"nmap <C-h> <C-w>h
"nmap <C-j> <C-w>j
"nmap <C-k> <C-w>k
"nmap <C-l> <C-w>l


"BufTab
"list all buffer
noremap <silent>bl : buffers<cr>
"使用<C-h>切换到上一个buffer
noremap <silent>bp :bprev<CR>
"使用<C-l>切换到下一个buffer
noremap <silent>bn :bnext<CR>
let g:buftabs_only_basename=1                      "只显示文件名,忽略路径名
set laststatus=2                                   "和下面的设置一起将buffer名显示在状态栏中
let g:buftabs_in_statusline=1

"A
"将,hc设置成头/源文件切换的快捷键,将窗口分为左右两个窗口,并打开.h/.c文件
nnoremap <silent> <leader>hc :AV<cr>
let g:alternateSearchPath = 'sfr:./,sfr:../include,sfr:../../include,sfr:../source,sfr:../src,sfr:../inc'

"设置补全
filetype plugin indent on
set completeopt=longest,menu
"let g:SuperTabRetainCompletionType=2
"let g:SuperTabDefaultCompletionType="<C-X><C-O>"

"设置Doxygen的注释
"let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
"let g:DoxygenToolkit_blockFooter="----------------------------------------------------------------------------"
let g:DoxygenToolkit_authorName="JZJ"
let g:DoxygenToolkit_briefTag_funcName = "yes"
map <silent> <leader>da :DoxAuthor<cr>
map <silent> <leader>df :Dox<cr>
map <silent> <leader>db :DoxBlock<cr>
map <silent> <leader>dc O/** */<Left><Left>

"set lookupfile
if filereadable("./filenametags")
 let g:LookupFile_TagExpr='"./filenametags"'
 let g:LookupFile_MinPatLength = 2     "最少输入2个字符才开始查找
 let g:LookupFile_PreserveLastPattern = 0   "不保存上次查找的字符串 
 let g:LookupFile_PreservePatternHistory = 0  "保存查找历史
 let g:LookupFile_AlwaysAcceptFirst = 1   "回车打开第一个匹配项目
 let g:LookupFile_AllowNewFiles = 1    "不允许创建不存在的文件
 "映射LookupFile为: ,lf
 nmap <unique> <silent> <leader>lf <Plug>LookupFile<cr>
 "映射LUBufs为: ,lb
 nmap <unique> <silent> <leader>lb :LUBufs<cr>
 "映射LUWalk为: ,lw
 nmap <unique> <silent> <leader>lw :LUWalk<cr>
endif

"NERD Comment
",cc 以//方式注释选择的行
",cs 以/*方式注释选择的行

" python
"let g:pcs_hotkey = 'cs'
let g:pcs_check_when_saving = 1
map <F12> :!python % <cr>
map <F9> :!perl %<cr>

" g++
map<F11> :!g++ -g %<cr>
map<F10> :!./a.out<cr>
     
" tab
map <silent>tf :tabfir<cr>
map <silent>tl :tabl<cr>

"misc
"nmap <silent> <F2> :set wrap<cr>
"nmap <silent> <F3> :set nowrap<cr>

map ti <Esc>:read !date<CR>kJ

 

 

你可能感兴趣的:(python,perl,文档,buffer,makefile,encoding)