VIM uses Vundle management to configure the Vim basic plugin

Source: Internet
Author: User
Tags autoload prototype definition using git


Vundle


Project hosting is Https://github.com/gmarik/vundle on GitHub.
Its features are the use of git to manage plug-ins, update convenience, support search, one-click Update, from then only need a VIMRC walk the world.



Add the following in the VIMRC file to enable Vundle to manage the functionality of the VIM plugin:


set rtp+=$VIM/vimfiles/bundle/vundle/ call vundle#rc(‘$VIM/vimfiles/bundle/‘) ‘gmarik/vundle‘


If you are a Linux system, you can add the following:


set rtp+=~/.vim/bundle/vundle/call vundle#rc()Bundle‘gmarik/vundle‘
Vundle command
  • : bundlelist-Lists all plugins configured in the list (. vimrc)
  • : Bundleinstall-All plugins in the installation list
  • : bundleinstall! -Update all plugins in the list
  • : Bundlesearch foo-find Foo Plugin
  • : bundlesearch! Foo-flush Foo plugin cache
  • : Bundleclean-Remove plugins that are not in the list
  • : bundleclean! -Clear plugins that are not in the list
Installation and use of common plug-ins ctags and TagList


TagList is a plug-in used to display various symbols in a locator program, such as macro definitions, variable names, struct names, function names, which we call symbols (symbols), and are called tags in taglist. Obviously, in order to display the tag in the program file, you need to know all the tag information in advance, save it in a file, and then parse the corresponding tag file. What taglist do is simply to parse the contents of the tag file and display it on vim. Tag scanning and data file generation are done by Ctags (exuberant Ctags), so your PC needs to have Ctags before using TagList.



VIMRC configuration information:


Bundle ‘taglist.vim’
let Tlist_Ctags_Cmd = ‘ctags’
let Tlist_Show_One_File = 1 "Don't show tags of multiple files at the same time, only show the current file's tags
let Tlist_WinWidt = 28 "Set the width of the taglist
let Tlist_Exit_OnlyWindow = 1 "If the taglist window is the last window, exit vim
"let Tlist_Use_Right_Window = 1" Show the taglist window in the right window
let Tlist_Use_Left_Windo = 1 "Show the taglist window in the left window

Jump to the position defined by tag under the cursor, and double-click the tag function with the mouse
o display the cursor under tag in a newly opened window
Display the prototype definition of tag under cursor
U update tag in taglist window
s change sort mode, toggle between sort by name and sort by order
x taglist window zooms in and out to make it easier to see longer tags
+ Open a folding, with Zo
-Fold the tag together with ZC
* Open all folds, with ZR
= Fold all tags together with ZM
[[Skip to previous file]
]] to skip to the next file
Q Close TagList window

Tagbar


Tagbar is a taglist alternative, more suitable for use in C + + than taglist, functions can be differentiated by class, support folding display by class, display results clear and concise.
Because taglist in the use of the Chinese language support is not good, when the folder is Chinese, unable to generate taglist, so here I use Tagbar, it can be a good solution to the Chinese problem.
Https://github.com/majutsushi/tagbar



About the configuration of the Tagbar:


Bundle ‘majutsushi / tagbar’
"nmap <Leader> tb: TagbarToggle <CR>" shortcut settings
let g: tagbar_ctags_bin = ‘ctags’ "The path of the ctags program
let g: tagbar_width = 30 "Setting the window width
map <F3>: Tagbar <CR>
"autocmd BufReadPost * .cpp, *. c, *. h, *. hpp, *. cc, *. cxx call tagbar # autoopen ()" If it is a C language program, the tagbar automatically opens 


For more configuration, see:help tagbar
You can use it after you configure it:Tagbaror press the configured shortcut key toF3open it.


Nerdtree


Nerdtree is a tree resource management plugin for browsing file systems that lets you browse the file system and open files or directories in Vim as you would with Windows Explorer.
Https://github.com/scrooloose/nerdtree



VIMRC configuration information:


 
Bundle ‘scrooloose/nerdtree‘
let NERDTreeWinPos=‘right‘
let NERDTreeWinSize=30
map <F2> :NERDTreeToggle<CR>


:NERDTreethe shortcut keys that can be used or configured after configuration areF2turned on.


Minibufexplorer


Minibufexplorer provides simultaneous editing of multiple files and displays the label of the file above the editor.
Https://github.com/fholgado/minibufexpl.vim



VIMRC configuration information:


 
 
Bundle ‘fholgado/minibufexpl.vim‘
let g:miniBufExplMapWindowNavVim = 1   
let g:miniBufExplMapWindowNavArrows = 1   
let g:miniBufExplMapCTabSwitchBufs = 1   
let g:miniBufExplModSelTarget = 1  
let g:miniBufExplMoreThanOne=0

map <F11> :MBEbp<CR>
map <F12> :MBEbn<CR>


Here the F11 and F12 keys are configured to jump before and after the buffer, which is more convenient. If you want to close a buffer, you can use the command:MBEbd [num], if only input:MBEbdis to close the current buffer, if followed by a number labeled buffer, the specified buffer is closed.



Here also want to say some bufexplorer this plug-in, this plug-in and Minibufexplorer function is similar, there are some discussion on the Internet between their advantages and disadvantages, but I will bufexplorer and Winmanager with the use of the time there will always be some problems, leads to some errors and conflicts, so it is decided to use simple minibufexplorer.


Vim-airline


Vim-airline is actually a copy of Powerline, which has several advantages over powerline: It is a pure vim script,powerline used in Python; it's simple, faster than powerline.
This is a status bar enhancement plug-in that makes your vim status bar very beautiful, including the Buffer Bar extension Smart Tab line and some plug-ins integrated.
Https://github.com/bling/vim-airline



VIMRC configuration information:


‘bling/vim-airline‘set laststatus=2
Winmanager (deprecated)


This winmanager has not been updated for a long time, the original version has a lot of small bugs, very uncomfortable to use, in the Internet to find some ways to improve, feeling is always unsatisfactory, the final decision to enable.
Here are just some of the information you'll find when you use it.



VIMRC configuration information:


 
Bundle ‘vim-scripts/winmanager‘
let g:NERDTree_title="[NERDTree]"
let g:winManagerWindowLayout="NERDTree|BufExplorer"

function! NERDTree_Start()
    exec ‘NERDTree‘
endfunction
function! NERDTree_IsValid()
    return 1
endfunction

nmap wm :WMToggle<CR>


This version of the Winmanager seems to have a small bug, when you open the Winmanager interface, you open an empty file at the same time. This can affect subsequent use, so we'll turn off the empty file when we open the Winmanager. The Togglewindowsmanager function definition is found in the Winmanager.vim file and is modified to the following:


 
function! <SID>ToggleWindowsManager() if IsWinManagerVisible()
        call s:CloseWindowsManager() else call s:StartWindowsManager()
        exe ‘q‘ end endfunction
Now the effect




Solve the problem of garbled characters in Windows vim display


Because the default is GB encoding under Windows, and Vim is utf-8 by default, opening will be garbled. Modified the configuration file, so that vim support GB encoding just fine.
Modify the VIMRC configuration file:


Let &termencoding=&encoding
Set FILEENCODINGS=UTF-8,GBK

The basic concepts involved in VIM coding


encoding variable: This option makes the text used for buffering (the file you are editing), registers, Vim script files, and so on. You can think of the ' encoding ' option as a setting for the internal operating mechanism of Vim.
The default value of the encoding variable is the same as the current locale of the system.
fileencoding Variable: This option is the type of encoding that VIM uses when writing to a file.
When Vim opens a file, it automatically recognizes its encoding, and fileencoding is the recognized value. Empty saves the file with encoding encoding, and if the encoding is not modified, that value is the current locale of the system.
termencoding Variable: This option represents the encoding type used by the output to the customer terminal (term).
The default null value, that is, the output to the terminal does not encode the conversion.


Add: Use pathogen to manage vim plugins


Pathogen allows each plugin to occupy a separate directory that solves the problem of file fragmentation. After installing pathogen, simply create a new directory ~/.vim/bundle/in the ~/.vim/directory and put all the plugins you want to install in the ~/.vim/bundle/directory. If you want to delete a plug-in, you only need to delete the corresponding plug-in directory in the ~/.vim/bundle/directory. If you want to keep a plug-in as the latest version, checkout a code into the bundle directory directly from the plugin's repository.


Install and enable pathogen


The pathogen is: Https://github.com/tpope/vim-pathogen
Can be extracted directly after download. The pathogen plugin only has a single script, so the installation is to put it in the current user's ~/.vim/autoload directory.
That is, copy the extracted AutoLoad directory together with the Pathogen.vim plugin inside the ~/.vim/directory.



To enable pathogen, you will also need to add the following sentence in the ~/.VIMRC file, anywhere before filetype plugin indent on:


Call Pathogen#infect ()

Installing plugins


To install a new plugin, simply download the plugin and place it in the ~/.vim/bundle/directory.
Assuming you want to download the install Nerdtree plugin, simply go to the ~/.vim/bundle/directory and execute the following command:


git clone http://github.com/scrooloose/nerdtree.git


After the download is complete, you will see a new directory in the ~/.vim/bundle/directory: Nerdtree. The Nerdtree plugin is already installed! Can see this way than the traditional vim plug-in installation method is much simpler!
and to uninstall the plug-in is also very simple, just need to delete the Nerdtree directory in the ~/.vim/bundle/directory, neat!
To update the plugin to the latest version, simply go to the directory ~/.vim/bundle/nerdtree/and execute the following command:


Git pull origin

Summary


Although the use of pathogen this method can also be a good management of vim plug-ins, compared to Vundle, they are using the GIT environment to download plug-ins, but Vundle feel more automated, you can directly use the command can be used to update and manage plugins.


Resources


Vim configuration and plug-in installation management (Super verbose)
Using the TagList plugin
Vim display Chinese garbled problem solved
Vim plugin easy to manage (using git submodule and pathogen)
Vim plugin management tool: Pathogen



reprint Please indicate the author Jason Ding and its provenance
Gitcafe Blog Home page (http://jasonding1354.gitcafe.io/)
GitHub Blog Home page (http://jasonding1354.github.io/)
CSDN Blog (http://blog.csdn.net/jasonding1354)
Jane Book homepage (http://www.jianshu.com/users/2bd9b48f6ea8/latest_articles)
Baidu Search jasonding1354 access to my blog homepage



VIM uses Vundle management to configure the Vim basic plugin


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.