Basic Configuration
In the case of any plug-in, the configuration is as follows:
set nusyntax onset hlsearchset tabstop=4set shiftwidth=4set expandtabset smartcaseset iccolorscheme srcery-drk
Vundle
Vundle is a plug-in manager for Vim, like Neobundle is also based on Vundle implementations.
Although the VIM plug-in can be installed independently, if you change the machine, the use of Vundle only need to copy one copy. Vimrc.
The installation method is not complex, first clone to the ~/.vim directory:
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Add the following to the ~/.VIMRC header:
set nocompatiblefiletype offset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()Plugin ‘VundleVim/Vundle.vim‘Plugin ‘tpope/vim-fugitive‘Plugin ‘git://git.wincent.com/command-t.git‘Plugin ‘file:///home/gmarik/path/to/plugin‘Plugin ‘rstacruz/sparkup‘, {‘rtp‘: ‘vim/‘}call vundle#end() " requiredfiletype plugin indent on " required
Save, execute in Vim PluginInstall
, and so on.
or execute the following command at the command line is the same effect:
vim +PluginInstall +qall
View Help:
:h vundle
Declare the plugin in ~/.VIMRC, for example:
Plugin ‘scrooloose/nerdtree‘lugin ‘shougo/vimshell.vim‘
Basic command:
" :PluginList - 列出所有插件" :PluginInstall - 安装插件" :PluginInstall! - 更新插件" :PluginSearch foo - 搜索foo插件" :PluginClean - 移除未使用插件
Nerdtree
Directory tree plugin, without this
The premise of installing the Vundle, declared in ~/.VIMRC nerdtree:
Plugin ‘scrooloose/nerdtree‘
The installation can be completed by executing the following command in VIM:
:source %:PluginInstall
My nerdtree configuration is as follows:
"============ nerdtree ============" Open Nerdtree by defaultautocmd vimenter * nerdtree "Synchronize nerdtree with Curre NT opened fileautocmd bufenter * LCD%:p: H "open nerdtree automatically when Vim starts up if no files were Specifiedautoc MD stdinreadpre * Let S:std_in=1autocmd vimenter * if argc () = = 0 &&!exists ("s:std_in") | Nerdtree | endif "Open Nerdtree automatically when Vim starts up on opening a directoryautocmd Stdinreadpre * let S:std_in=1autocmd V Imenter * if argc () = = 1 && isdirectory (argv () [0]) &&!exists ("s:std_in") | EXE ' Nerdtree ' argv () [0] | Wincmd p | Ene | endif "Open nerdtree with Ctrl+nmap <C-n>:nerdtreetoggle<cr>" View the current buffer in Nerdtreemap <lead Er>r:nerdtreefind<cr> "Close vim if the only window left open is a nerdtreeautocmd bufenter * if (WINNR (" $ ") = = 1 && exists ("B:nerdtree") && b:nerdtree.istabtree ()) | Q | endif "Change arrowslet g:nerdtreedirarrowexpandable = '? ' Let G:nerdtreedirarrowcollapsible = '? ' "Show hidden files by Defaultlet nerdtreeshowhidden=1
Common shortcut keys for Nerdtree:
shortcut Keys |
Description |
? |
View Help |
m |
Outbound menu, working with the current directory |
r |
Refresh Directory |
F |
Show, hide hidden files |
A |
Catalog Tree Cut fullscreen |
go |
Open the file, the cursor stays on the directory tree |
i |gi |
Horizontal open Window |
s |gs |
Open Window vertically |
ctrl +w +h |j |k |l |
Arrow key Selection window |
ctrl +w +w |
Cut window |
t |T |
In the Tab open window |
gt |gT |
Cut tab |
If you use Git, you have a nerdtree extension that displays the Git status of the file in the directory tree.
The installation is still via Vundle, and the plugin is declared as follows:
Plugin ‘Xuyuanp/nerdtree-git-plugin‘
Tagbar
When a person reads a code, if the IDE opens another project, the project is typically not imported into the IDE and read the code with VIM.
Just jump to the function of a variable or function only through the gD
words, the position of the jump is not very accurate.
Tagbar can generate a list of variables and functions in a file.
With Vundle installation, add the following statement to ~/.VIMRC:
Plugin ‘majutsushi/tagbar‘
Save, execute :PluginsInstall
, wait for the process to end.
The configuration for personal use is as follows:
let g:tagbar_width = 30nmap <F10> :TagbarToggle<CR>let g:tagbar_autopreview = 1let g:tagbar_sort = 0
After the source configuration file, re-enter vim and press F10
Exhale Tagbar.
MacOS may have the following prompt:
Tagbar:ctags doesn ' t seem to be exuberant ctags!
Tagbar relies on exuberant Ctags 5.5, after which the brew install ctags
vim can be re-entered.
Vim-Common configuration