Linux editor Vim

Source: Internet
Author: User
Tags set background

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:

    1. Tracking and managing plug-ins in. VIMRC
    2. Install plug-ins in a specific format (a.k.a. Scripts/bundle)
    3. Update a specific format plugin
    4. Search for plugins in vim scripts via plugin name
    5. Clean unused plugins
    6. You can do this with a single button

Vundle Auto-complete

    1. Managing the runtime path for installed plugins
    2. 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

    1. The plug-in you want to install, according to the address method, fill in the address between Vundle#begin and vundle#end can be
    2. 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
    1. Edit the. vimrc file to remove the plugin line that corresponds to the plugin you want to remove.

    2. Save to exit the current vim

    3. Re-open vim and enter the command BundleClean .

Other common commands
    1. Update PluginBundleUpdate

    2. List all pluginsBundleList

    3. Find PluginsBundleSearch




Linux editor Vim

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.