<pre code_snippet_id="321505" snippet_file_name="blog_20140430_1_1397668" name="code" class="plain">" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
syntax on
endif
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"nset showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available
"按F5切换行号显示
map <F5> :set nu!<CR>
"map <S-F5>:set nonu<CR>
filetype plugin indent on
set completeopt=longest,menu
set history=1000
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set ruler
set cursorline
set hlsearch
set incsearch
set nocompatible
set cin
set cino=:4g4t4
set nu
syntax on
filetype on
au BufRead,BufNewFile * setfiletype txt
"自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {<CR>}<ESC>O
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
filetype plugin indent on
"打开文件类型检测, 加了这句才可以用智能补全
set completeopt=longest,menu
"if has("vms")
" set nobackup
"else
" set backup
"endif
"""""""""""""设置开启ctags"""""""""""""
map <F4> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>
"第一个命令里的分号是必不可少的。这个命令让vim首先在当前目录里寻找tags文件,如果没有找到tags文件,或者没有找到对应的目标,就到父目录 中查找,一直向上递归。因为tags文件中记录的>路径总是相对于tags文件所在的路径,所以要使用第二个设置项来改变vim的当前目录。
set tags=tags;
set autochdir
"绝对路径
"set tags=/home/long/workstation/ganguio/uio-8139d-driver/V7/tags,/home/long/linux-3.7.3/drivers/uio/tags
"""""""""""""""""Taglist设置"""""""""""""""""
map <F3> : Tlist<CR> ""按下F3就可以呼出
"let Tlist_Auto_Open = 1 "在启动VIM后,自动打开taglist窗口
let Tlist_Ctags_Cmd = '/usr/bin/ctags' "设定ctags的位置
let Tlist_Use_Right_Window=0 " 1为让窗口显示在右边,0为显示在左边
let Tlist_Show_One_File=0 "让taglist可以同时展示多个文件的函数列表,设置为1时不同时显示>多个文件的tag,只显示当前文件的
let Tlist_File_Fold_Auto_Close=1 "同时显示多个文件中的tag时,taglist只显示当前文件tag,>其他文件的函数列表折叠隐藏
let Tlist_Exit_OnlyWindow=1 "当taglist是最后一个分割窗口时,自动退出vim
"let Tlist_Use_SingleClick= 1 " 缺省情况下,在双击一个tag时,才会跳到该tag定义的位置
"let Tlist_Process_File_Always=0 "是否一直处理tags.1:处理;0:不处理
"打开taglist时焦点自动转到taglist窗口"
"Tlist_GainFocus_On_ToggleOpen=1
"""""""""""""""""""""""cscope设置""""""""""""""""""
set cscopequickfix=s-,c-,d-,i-,t-,e-
if has("cscope")
set csprg=/usr/bin/cscope
set csto=1
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
endif
set csverb
endif
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>
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
cs add ~/Documents/linux3.13/linux-3.13.3/cscope.out ~/Documents/linux3.13/linux-3.13.3
上次ubuntu崩溃了,备份下买个教训