之前因为电脑重装了,只备份了之前vimrc的配置文件,今天在使用的时候就是tagbar和NERDTree一直不生效,下列是解决方法,或将我已打包好的.vim文件夹和.vimrc拷贝进去,即可使用。
若需要安装NERDTree插件,方法如下:
wget http://www.vim.org/scripts/download_script.php?src_id=17123 -O nerdtree.zip
unzip nerdtree.zip
mkdir -p ~/.vim/{plugin,doc}
cp plugin/NERD_tree.vim ~/.vim/plugin/
cp doc/NERD_tree.txt ~/.vim/doc/
安装tagbar插件如下:
a. http://www.vim.org/scripts/script.php?script_id=3465
该网站为下载地址,下载 tagbar.vmb
b. 用vim打开: vim tagbar.vmb
c. 底行模式输入:so %
下列为个人习惯.vimrc的配置文件,若安装vim完毕后无.vimrc,可自己创建
syntax on
filetype on
au BufRead,BufNewFile *.sv set filetype=systemverilog
au BufRead,BufNewFile *.v set filetype=verilog
set nu
set mouse=a
set hlsearch
set ff=unix
" 记住上次位置
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
nmap <silent> <F4> :TagbarToggle<CR>
let g:tagbar_ctags_bin = '/usr/bin/ctags'
let g:tagbar_width = 50
let g:tagbar_left=1
" NERD tree
let NERDChristmasTree=0
let NERDTreeWinSize=35
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
let NERDTreeShowBookmarks=1
let NERDTreeWinPos="right"
" Automatically open a NERDTree if no files where specified
autocmd vimenter * if !argc() | NERDTree | endif
" Close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Open a NERDTree
nmap <F8> :NERDTreeToggle<cr>
" cscope setting
if has("cscope")
if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
if filereadable("cscope.out")
cs add cscope.out
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
endif
map <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
map <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
map <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
map <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
map <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
map <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
map <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
map <C-\>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
map <F6> :cs find d<space>
" TABLE == 4 SPACE
set ts=4
" hanzi support
set fencs=utf-8,GB18030,ucs-bom,default,latin1
" 状态栏
set laststatus=2 " 总是显示状态栏
highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue
" 获取当前路径,将$HOME转化为~
function! CurDir()
let curdir = substitute(getcwd(), $HOME, "~", "g")
return curdir
endfunction
set statusline=[%n]\ %f%m%r%h\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\ ascii=%b,hex=%b%{((&fenc==\"\")?\"\":\"\ \|\ \".&fenc)}\ \|\ %{$USER}\ @\ %{hostname()}\
set list
set listchars=tab:>-,trail:-