VIM Installation
To install vim under Unbuntu, enter the command:
sudo apt-get install vim
Vim Configuration
When using vim for editing under the terminal, by default, the editing interface is not displaying line numbers, syntax highlighting, smart indenting, and so on. In order to better work under Vim, a configuration file needs to be set manually:. vimrc. Only for individual users in their current directory under the. VIMRC modification, the content is only valid for the user, to be effective, you can modify the/ETC/VIM/VIMRC. When Vim is started, the. vimrc file under the current user's root directory is automatically read, and the file can contain settings and even scripts, so it is generally convenient to create a. vimrc file under the current user's root directory, which is created as:
$vi ~/.VIMRC
Basic configuration:
Turn on syntax highlighting: syntax on
Auto indent by file type: filetype indent plugin on
Displays the current line number column number: Set ruler
Show the command being entered in the status bar: Set ShowCmd
Close/Open paired brackets highlight: Nomatchparen/domatchparen
Display Line numbers: Set number
Background adjustment color: Set Background=dark
Wait a minute
Ready-made VIM configuration https://github.com/spf13/spf13-vim/
Vim Plugin manager vim Bundle (vundle) Installation Vundle Introduction
Vim lacks the default plug-in Manager, all the plug-in files are scattered in several folders under ~/.vim, plug-in installation and update and delete all need to manually, both cumbersome and possible errors. Vundle is the short name of the vim bundle and is a VIM plugin manager.
Vundle allows you to do:
- Tracking and managing plug-ins in. VIMRC
- Install plug-ins in a specific format (a.k.a. Scripts/bundle)
- Update a specific format plugin
- Search for plugins in vim scripts via plugin name
- Clean unused plugins
- You can do this with a single button
Vundle Auto-complete
- Managing the runtime path for installed plugins
- Rebuild the Help tab after installation and update
Vundle Installation
$ git clone https://github.com/vundlevim/vundle.vim.git ~/.vim/bundle/vundle.vim
The default installation path is:/.vim/bundle/vundle
Note: If you do not have Git installed, use the following command to install it:
sudo apt-get install git
Configuring the Vundle Plugin
Open the ~/.VIMRC file via vim at the terminal,
$ vim ~/.VIMRC
After installing the new plugin, you can edit the. vimrc file directly and add the plugin, as shown in the following example:
Set nocompatible"To Remove the VI consistency, you must addFileType off"you have to add"Setup includes vundle and initialization related runtime pathSet rtp+=~/.vim/bundle/vundle.vimcall vundle#begin ()"Another option, specify a path to the Vundle installation plug-in"Call vundle#begin (' ~/some/path/here ')"to have vundle manage the plug-in version, you mustPlugin'Vundlevim/vundle.vim'"The following example is used to support plug-in installation in different formats."please place the command to install the plugin between Vundle#begin and Vundle#end."Plugins on GitHub"format Plugin ' user name/plugin repository name 'Plugin 'tpope/vim-fugitive'"plugins from the http://vim-scripts.org/vim/scripts.html"Plugin ' plugin name ' is actually Plugin ' vim-scripts/plugin repository name ' Just the user name here can be omittedPlugin'L9'"plugin repositories supported by Git but no longer on GitHub Plugin ' git clone's address 'Plugin'Git://git.wincent.com/command-t.git'"local git repository (e.g. your own plugin) Plugin ' file:///+ local plugin repository absolute path 'Plugin'File:///home/gmarik/path/to/plugin'"The plug-in is in a subdirectory of the repository."specify the path correctly to set the Runtimepath. The following example plugin is in the Sparkup/vim directoryPlugin'Rstacruz/sparkup', {'RTP':'vim/'}"Install L9, if you have installed this plugin, you can use the following format to avoid naming conflictsPlugin'Ascenator/l9', {'name':'newL9'}"all your plugins need to be here before this lineCall Vundle#end ()"must beFileType plugin indent on"vim must be loaded with the appropriate syntax and file type related scripts for the plugin"Ignore the plugin change indentation, you can use the following substitution:"filetype plugin on""Common Commands":P luginlist-List all configured plugins":P lugininstall-Install plugin, append '! ' to update or use:P luginupdate":P luginsearch foo-search foo; append '! ' to clear local cache":P Luginclean-Remove unused plug-ins, need to confirm; Append '! ' automatically approve remove unused plugins""check: H vundle for more details and wiki and FAQs"put yourself on a non-plugin fragment after this line
Install the required plugins
- The plug-in you want to install, according to the address method, fill in the address between Vundle#begin and vundle#end can be
- After saving, there are two ways to install the plugin.
(1) Run vim, input in vim: Plugininstall
$vim:P Lugininstall
(2)通过命令行直接安装
Vim +plugininstall +qall
Remove unwanted plugins
Edit the. vimrc file to remove the plugin line that corresponds to the plugin you want to remove.
Save to exit the current vim
Re-open vim and enter the command BundleClean
.
Other common commands
Update PluginBundleUpdate
List all pluginsBundleList
Find PluginsBundleSearch
Linux editor Vim