如何在 vim 中为 .vimrc 安装缺失的软件包

如何在 vim 中为 .vimrc 安装缺失的软件包

我已经.vimrc从网上下载了一个(这里)Bundles.其中一些是我得到的

Not an editor command : Bundle *****

我怎样才能以最简单的方式安装那些缺失的软件包。我是 vim 软件包的新手。

这是.vimrc我下载的,供参考。

set nocompatible               " be iMproved
filetype plugin indent on     " required!

set rtp+=~/vimfiles/bundle/vundle/
call vundle#rc()
let g:vundle_default_git_proto = 'git'
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

" My Bundles here:
"
" original repos on github
Bundle 'bling/vim-airline'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'vim-scripts/Vimtodo'
Bundle 'molokai'
Bundle 'oblitum/rainbow'
Bundle 'vimwiki/vimwiki'
Bundle 'chriskempson/vim-tomorrow-theme'
Bundle 'sk1418/last256'
Bundle 'kshenoy/vim-signature'
Bundle 'rking/ag.vim'
Bundle 'xolox/vim-misc'
Bundle 'w0ng/vim-hybrid'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-commentary'
Bundle 'tmhedberg/matchit'

" map copy/paste
map <Leader>p "+p
map <Leader>y "+y
set clipboard=unnamed
cnoremap <c-v> <c-r>+

" search
set hlsearch
set incsearch
set number
set ignorecase
vmap // y/\V<C-R>"<CR>

set scrolloff=5

" Navigate 4x faster when holding down Ctrl
nmap <c-j> 4j
nmap <c-k> 4k
nmap <c-h> 4h
nmap <c-l> 4l

imap <TAB> <C-N>

" ctags
"nnoremap <C-S-]> :ts<CR>

" Jump to matching pairs easily, with Tab
"nnoremap <Tab> %
"vnoremap <Tab> %

" remap :
nnoremap ; :

" set spelling
"setlocal spell spelllang=en_us
nmap <silent> <leader>s :set spell!<CR>
map <silent> <leader>S z=
set sps=best,10

" set the locaiton for swp files
set directory=e:\personal
set backupdir=e:\personal

" flashes matching brackets or parentheses
set showmatch

" Fix for legacy vi inconsistency
map Y y$

syntax on
"colorscheme Tomorrow
colorscheme hybrid

if &diff
  colorscheme hybrid
  set lines=999 columns=999
  unmap <c-j>
  unmap <c-k>
  nmap <c-j> ]c
  nmap <c-k> [c
endif

" terminal color
if &term =~ "xterm"
  "256 color --
  let &t_Co=256
  " restore screen after quitting
  set t_ti=ESC7ESC[rESC[?47h t_te=ESC[?47lESC8
  if has("terminfo")
    let &t_Sf="\ESC[3%p1%dm"
    let &t_Sb="\ESC[4%p1%dm"
  else
    let &t_Sf="\ESC[3%dm"
    let &t_Sb="\ESC[4%dm"sjl/gundo.vim
  endif
endif

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Display extra whitespace
set list listchars=tab:»·,trail:·

set autoindent
set smartindent
set smarttab
set shiftwidth=2
set softtabstop=2
set tabstop=2
set expandtab

" Linebreak on 500 characters
set lbr
set tw=500

set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines

set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current

" set the language
set langmenu=none

" set visual bell -- i hate that damned beeping
set vb

" set history length
set history=700

" disable the menu
set guioptions-=m  "remove menu bar
set guioptions-=T  "remove toolbar

" show the current line
set cul

" set the font
set guifont=Consolas:h11

" show the filename in the bottom of the window
set modeline
set ls=2

" rainbow conf
au FileType c,r,xdm,m4,cpp,objc,objcpp call rainbow#load()

" search for tags in the current directory then one up until the tags are
" found
set tags=tags;/

" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>

" window navigation
nmap <silent> <A-k> :wincmd k<CR>
nmap <silent> <A-j> :wincmd j<CR>
nmap <silent> <A-h> :wincmd h<CR>
nmap <silent> <A-l> :wincmd l<CR>

" resize windows
nmap <silent> <S-k> :resize +5<CR>
nmap <silent> <S-j> :resize -5<CR>
nmap <silent> <S-h> :vertical resize +5<CR>
nmap <silent> <S-l> :vertical resize -5<CR>

" show the column
nnoremap <silent> <Leader>c :silent set colorcolumn=100<CR>:set colorcolumn?<CR>
nnoremap <silent> <Leader>C :silent set colorcolumn=<CR>:set colorcolumn?<CR>

" allow backspacing over everything in insert-mode
set backspace=indent,eol,start

" Remap VIM 0 to first non-blank character
map 0 ^

au BufNewFile,BufRead *.xdm set filetype=xml
au BufNewFile,BufRead *.xdm.m4 setlocal filetype=xml
au BufNewFile,BufRead *.c.m4 set filetype=c

" Ag
let g:agprg="ag -i -p path.agignore --search-binary"
let g:aghighlight=1
let g:agformat="%f:%l:%m"

nnoremap <F3> :cnext<CR>
nnoremap <F2> :cprevious<CR>

nnoremap <Leader>e :Ag!  <C-R>=GetRootPath()<CR><C-Left><Left>
nnoremap <Leader>r :Ag! <C-R><C-W> <C-R>=GetRootPath()<CR><CR>
nnoremap <Leader>E :AgFile!  <C-R>=GetRootPath()<CR><C-Left><Left>

nnoremap <Leader>d :call DiffTilComit()<CR>

function! GetRootPath()
  let path_2 = expand("%:p:h")
  " deleted
  return path_1
endfunction

function! DiffTilComit()
  let path_1 = expand("%:t")
  let path_2 = expand("%:p:h").'\.svn\text-base\'.path_1.'.svn-base'
  let path_3 = expand("%:p:h").'\'.path_1
  exe 'tabnew '.path_3
  exe 'vert diffsplit '.path_2
endfunction

" toggle between number and relativenumber
function! ToggleNumber()
  if(&relativenumber == 1)
    set norelativenumber
    set number
  else
    set relativenumber
  endif
endfunc
nnoremap <F10> :call ToggleNumber()<cr>

" strips trailing whitespace at the end of files. this
" is called on buffer write in the autogroup above.
function! StripTrailingWhitespaces()
  " save last search & cursor position
  let _s=@/
  let l = line(".")
  let c = col(".")
  %s/\s\+$//e
  let @/=_s
  call cursor(l, c)
endfunction
nnoremap <Leader>st :call StripTrailingWhitespaces()<cr>

" autoreload $MYVIMRC
augroup reload_vimrc " {
  autocmd!
  autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END " }

nnoremap b] :bnext<CR>
nnoremap b[ :bprevious<CR>

nnoremap <Leader><Leader>n :silent !"C:\Program Files (x86)\Notepad++\notepad++.exe" %:p<CR><CR>

set autoread

augroup project
  autocmd!
  autocmd BufRead,BufNewFile *.h,*.c,*.m4 set filetype=c.doxygen
augroup END

let &path.="C:\Projects\trunk,"

vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)

"I search things usual way using /something
"I hit cs, replace first match, and hit <Esc>
"I hit n.n.n.n.n. reviewing and replacing all matches
vnoremap <silent> s //e<C-r>=&selection=='exclusive'?'+1':''<CR><CR>
      \:<C-u>call histdel('search',-1)<Bar>let @/=histget('search',-1)<CR>gv
omap s :normal vs<CR>

" set the curent directory
set autochdir

" Return to last edit position (You want this!) [N]
autocmd BufReadPost *
      \ if line("'\"") > 0 && line("'\"") <= line("$") |
      \   exe "normal! g`\"" |
      \ endif

au FileType qf call AdjustWindowHeight(3, 15)
function! AdjustWindowHeight(minheight, maxheight)
  let l = 1
  let n_lines = 0
  let w_width = winwidth(0)
  while l <= line('$')
    " number to float for division
    let l_len = strlen(getline(l)) + 0.0
    let line_width = l_len/w_width
    let n_lines += float2nr(ceil(line_width))
    let l += 1
  endw
  exe max([min([n_lines, a:maxheight]), a:minheight]) . "wincmd _"
endfunction

" sync scroll
nnoremap <Leader>sw :set scb!<CR>

"fullscreen
function! ToggleFullScreen()
  if has('win32')
    :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)
  endif
endfunction

" for quickfix set nowrap
au FileType qf set nowrap

" ignore .svn in newtr
let g:netrw_list_hide= '.*\.svn$'

答案1

:Bundle是提供的命令文德尔,一款流行的插件管理器。阅读其 README 和文档小心

但使用别人的vimrc是一个非常糟糕的主意。你应该尽快重新考虑这个决定。

相关内容