~/.vimrc :
""""""""""""""""""""update in 2014.05.22""""""""""""""""""""
"终端提示符 颜色设置 具体颜色可在 查询"
:silent !echo -ne "\e]12;Red1\007"
let &t_SI = "\e]12;Red1\007"
let &t_EI = "\e]12;Red1\007"
autocmd VimLeave * :!echo -ne "\e]12;Red1\007"
""set tags=tags;
""set tags+=/home/hdvr/src/tags
""cs add cscope.out
set autochdir
set tags+=/usr/include/tags
function! AutoLoadCTagsAndCScope()
let max = 5
let dir = './'
let i = 0
let break = 0
while isdirectory(dir) && i < max
if filereadable(dir . 'cscope.out')
execute 'cs add ' . dir . 'cscope.out'
let break = 1
endif
if filereadable(dir . 'tags')
execute 'set tags =' . dir . 'tags'
let break = 1
endif
if break == 1
execute 'lcd ' . dir
break
endif
let dir = dir . '../'
let i = i + 1
endwhile
endf
"nmap :call AutoLoadCTagsAndCScope()
call AutoLoadCTagsAndCScope()
"修改c文件后 自动更新 当前目录下的tags"
function! RegenTag()
let tagfile = findfile("tags", ".;")
if strlen(tagfile) == 0
let tagfile = "./tags"
endif
call system("ctags --tag-relative -a --extra=+q -o " .tagfile ." " .expand("%:p"))
endfunction
""au BufWritePost *.cpp,*.h,*.c,*.def call RegenTag()
"Tlist 只在一个文件显示"
let Tlist_Show_One_File = 1
"在右边显示Tlist"
let Tlist_Use_Right_Window = 1
"最后只剩Tlist时自动关闭vim"
let Tlist_Exit_OnlyWindow = 1
"自动打开Tlist"
""let Tlist_Auto_Open=1
"显示行号"
set number
""语法高亮""
syntax on
""自动缩进""
set autoindent
set smartindent
set cindent
"粘贴前后按F3 取消自动缩进"
set pastetoggle=
""高亮当前行""
set cursorline
""hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
""右下角显示光标位置""
set ruler
""搜索时忽略大小写""
set ignorecase
""加强式查找""
set incsearch
""高亮搜索""
set hlsearch
""tab键用空格键代替""
""set expandtab
""一个tab键用4个空格代替""
""set tabstop=4
"括号自动完成
inoremap ( ()i
inoremap [ []i
inoremap { {}i
inoremap " ""i
inoremap ' ''i
"关掉智能补全时的预览窗口"
set completeopt=longest,menu
" C的编译和运行
map :call CompileRunGcc()
func! CompileRunGcc()
exec "w"
exec "!gcc % -o %<"
exec "! ./%<"
endfunc
" C++的编译和运行
map :call CompileRunGpp()
func! CompileRunGpp()
exec "w"
exec "!g++ % -o %<"
exec "! ./%<"
endfunc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"gvim"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"最大化窗口
function! Maximize_Window()
silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
endfunction
set mousemodel=popup
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"gvim use desert.vim vim model use evening.vim"
if has("gui_running")
colorscheme desert
let Tlist_Auto_Open=1
else
colo evening
endif
阅读(1150) | 评论(0) | 转发(0) |