我的.vimrc

"以下为基本的设置
" Enable filetype plugin
filetype plugin on
set hlsearch 
"高亮显示搜索结果
set sta
"插入<tab>时使用'shiftwidth'
filetype on
"检测文件类型
set ruler
"右下角显示光标位置的状态行
set wildmenu
"增强模式中的命令行自动完成操作
set cin    
"实现C程序的缩进
set sw=4   
"设计(自动) 缩进使用4个空格
set sta    
"插入时使用'shiftwidth'
set backspace=2
"指明在插入模式下可以使用删除光标前面的字符
syntax enable
"设置高亮关键字显示
set nocompatible
"去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
set history=1000
""记录历史的行数
set background=dark
"背景使用黑色
set autoindent
set smartindent
"上面两行在进行编写代码时,在格式对起上很有用;
"第一行,vim使用自动对起,也就是把当前行的对起格式应用到下一行;
"第二行,依据上面的对起格式,智能的选择对起方式,对于类似C语言编写上很有用
"第一行设置tab键为4个空格,第二行设置当行之间交错时使用4个空格
set tabstop=4
set shiftwidth=4
set showmatch
"设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号
set ruler
"在编辑过程中,在右下角显示光标位置的状态行
set incsearch
"查询时非常方便,如要查找book单词,当输入到/b时,会自动找到第一
"个b开头的单词,当输入到/bo时,会自动找到第一个bo开头的单词,依
"次类推,进行查找时,使用此设置会快速找到答案,当你找要匹配的单词
"时,别忘记回车。
set winaltkeys=no
"Alt组合键不映射到菜单上
"处理乱码
"set fileencodings=utf-8,gb2312,gbk,gb18030
"set termencoding=utf-8
"set fileformats=unix
"set encoding=prc
let &termencoding=&encoding 
set fileencodings=utf-8,gbk,ucs-bom,cp936 
"对NERD_commenter的设置
let NERDShutUp=1
set hidden
"隐藏已修改buffer
autocmd FileType python setlocal et sta sw=4 sts=4
filetype indent on
filetype plugin on
" Set to auto read when a file is changed from the outside
set autoread
set showcmd
"在vim窗口的右下角显示一个完整的命令已经完成的部分。
"以上为基本的环境配置
"禁用鼠标支持
set mouse=
















"以下为插件等的配置
"以下为吴垠的参考资料中的设置
syntax enable
syntax on
colorscheme desert
filetype plugin on
:set nu
:set tags+=/home/bingo/src/tags
:set tags+=~/.vim/systags
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>
:set cscopequickfix=s-,c-,d-,i-,t-,e-
:cs add /home/bingo/src/cscope.out /home/bingo/src
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i <C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>


map <F5> :w<CR>:make<CR>
map <F5><F5> :make clean<CR>
map <F6> :cw<CR>
map <F6><F6> :ccl<CR>
map <F7> :cn<CR>
map <F7><F7> :cp<CR>


let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
"cpp/c and .h files
nnoremap <silent> <F11> :A<CR>
let g:alternateExtensions_cpp = "h"
let g:alternateExtensions_c = "h"
nnoremap <silent> <F3> :Egrep<CR>
filetype plugin indent on
set completeopt=longest,menu
let g:SuperTabRetainCompletionType=1
let g:SuperTabDefaultCompletionType="<C-X><C-N>"
set foldmethod=syntax
set foldlevel=100
"以上全部参考吴垠资料




"添加作者信息
let g:vimrc_author='bingoboy' 
let g:vimrc_email='827603830@qq.com' 
let g:vimrc_homepage='acm.uestc.edu.cn'
nmap <F4> :AuthorInfoDetect<cr>








"映射F8为添加cscope和ctags
map <F8> :call Do_CsTag()<CR>
map <F8><F8> :call Add_CsTag()<CR>
function Do_CsTag()
silent! execute "!ctags -R '.'"
if(executable('cscope') && has("cscope") )
silent! execute "!find -L `pwd` -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.java' -o -name '*.cs' -o     -name '*.cxx' -o -name '*.hxx'> cscope.files -o -name '*.hpp' -o -name '*.py'"   
endif
silent! execute "!cscope -bq"
silent! execute "call Add_CsTag()"
endf
function Add_CsTag()
if filereadable("cscope.out")
execute "cs add cscope.out"
execute "set tags+=./tags"
endif
endf
silent! execute "call Add_CsTag()"




"echofunc原型提示
"let g:EchoFuncKeyNext='<C-e>'
"let g:EchoFuncKeyPrev='<C-p>'
:inoremap ( ()<ESC>i
:inoremap ' ''<ESC>i
:inoremap " ""<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap > <c-r>=ClosePair('>')<CR>
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf




"定义源代码格式化
map <F12> :call FormartSrc()<CR>
"定义FormartSrc()
func FormartSrc()
exec "w"
if &filetype == 'c'
exec "!astyle % –style=ansi –suffix=none %"
exec "e! %"
elseif &filetype == 'cpp'
"exec "!astyle % –style=ansi –suffix=none %"
"exec "e! %"
elseif &filetype == 'perl'
exec "!astyle –style=gnu –suffix=none %"
exec "e! %"
elseif &filetype == 'py'
exec "!astyle –style=gnu –suffix=none %"
exec "e! %"
elseif &filetype == 'java'
exec "!astyle –style=java –suffix=none %"
exec "e! %"
elseif &filetype == 'jsp'
exec "!astyle –style=gnu –suffix=none %"
exec "e! %"
elseif &filetype == 'xml'
exec "!astyle –style=gnu –suffix=none %"
exec "e! %"
elseif &filetype == 'html'
exec "!astyle –style=gnu –suffix=none %"
exec "e! %"
elseif &filetype == 'htm'
exec "!astyle –style=gnu –suffix=none %"
exec "e! %"
endif
endfunc
"结束定义FormartSrc
"为shell添加执行权限
function ModeChange()
 if getline(1) =~ "^#!"
 if getline(1) =~ "/bin/"
 silent !chmod a+x <afile>
 endif
endif
endfunction
au BufWritePost * call ModeChange()
"reset leader
let mapleader = ","



"快捷键
map <C-a> ggVG
map <S-q><S-q> :q!<CR>:q!<CR>:q!<CR> 
map <C-H> :L1,L2s/src/tar/g
"code_complete
"shortcut <C-o>
"
"c reference stl reference  and man handbook
",cr ,sr and <S-k>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值