Linux getting started Tutorial: build your own Vim

Source: Internet
Author: User

Linux getting started Tutorial: build your own Vim

In a Linux system, many things exist in the form of script code and configuration files. When using a Linux system, these files must be edited frequently. Obviously, without a text editor, it would be hard to get on the road.

My choice is Vim. Vim is the most famous text/code editor on Linux systems and an enhanced version of the Vi editor in the early years. I think it has gained such a reputation mainly for the following reasons: 1. It is ancient and mysterious, and its learning curve is steep and difficult to control, but it has benefited a lot once learned. It is now seen as a professional editor dedicated to Geek. Therefore, although Vim is already an antique software, there are still a few new people who want to learn and use it. 2. the tool is light and does not need to be mentioned. When you only need to edit a text file (such as script code and configuration file), the lighter the tool, the better. Vim is also a powerful tool for reading text files. 3. Classic clever editing methods and powerful functions. It uses keyboard operations throughout the process. You must remember a bunch of shortcuts, key combinations, and various commands before you can start using them. Once you are proficient, the editing efficiency far exceeds that of other editors, it also has a variety of plug-ins, syntax highlighting, code complementing, color schemes, and other extremely rich resources and flexible configuration;

I mainly use Vim in the following situations: 1. it is used to modify the configuration file of the server system. In many cases, Linux as a server does not enable graphical interfaces. When remote operations are required, you can only use the Shell Interface of SSH "command character" to operate on it. In this case, Vim is naturally the first choice. 2. Read the kernel source code and system scripts for the same reason. 3. simple programs are generally single-file programs, or projects with multiple files but only a few files. For example, when learning a programming language and doing exercises, I like to see that the folder is clean, don't like a bunch of similar. project file; 4. it's cool to install B, a colorful full text character interface.

Not suitable for Vim scenarios: 1. IDE is recommended for large programming projects and large projects. If you want to remotely connect a server without a graphical interface to write a large project, you 'd better establish a code repository on the server. Reason: VIM does not have a good project management function. VIM's Automatic completion function is only based on text matching, and does not have the semantic analysis function of programming languages. 2. the input of content is not high, but the display format is often required, and there is a lot of pause between each action, using other GUI editors (such as LibreOffice Writer) it is more efficient than VIM.

Some people say that Vim is a "Success plug-in, failure plug-in ". Vim's flexible configuration and rich plug-ins greatly enhance its functions, but they also greatly increase the difficulty of managing Vim. First, you must configure Vim before using it, and the Vim configuration is extremely cumbersome. Therefore, there are many articles on the Internet, such as "omnipotent configuration" and "strongest configuration", which can be referenced. However, some of these articles have many errors, even repeated and conflicting content. They are "giving fish instead of giving fish". Although the configurations they provide can be copied, but it is often unknown. Vim has rich plug-ins and many articles on the Internet using various plug-ins to configure Vim as a powerful IDE, but it is very difficult to manage Vim plug-ins because every time a plug-in is installed, you must put the plug-in files in the plug-in, autoload, syntax, and doc directories under the Vim installation path. Fortunately, Vundle is born, which not only solves the problem that Vim plug-ins are scattered in the file system, but also automatically searches for and downloads plug-ins.

-------------------------------------- Split line --------------------------------------

Build VIM into a simple and practical IDE

Vim Learning Guide

Quick learn Vi Editor

Powerful Vim Editor

Build a Vim Development Environment on CentOS 6.2

Install the highlighted Vim editing tool in CentOS 5.4

Vim tips: C language settings

Set the Vim row number in Ubuntu

Vim editor basic tutorial

-------------------------------------- Split line --------------------------------------

Install and configure Vim

Before using Vim, you must install it first. However, this is not a problem in Ubuntu. You can run a sudo aptitude install command. Because the Vundle search and download plug-ins require git, install vim, gvim, and git at the same time, as shown below:

Sudo aptitude install vim

Sudo aptitude install gvim

Sudo aptitude install git

Then, create the. vim directory in the user's home directory and the bundle directory in the. vim directory. The plug-ins automatically downloaded by Vundle will be saved here. Then, go to the Bundle directory and run the git clone command to download vundle.

The following shows my configuration file (The. vimrc file in the main directory ). My configuration is different from the "omnipotent configuration" and "strongest configuration" circulating on the Internet ". My configuration is the "simplest configuration" that can achieve the desired effect ". Lines 1st to 17. Vundle is configured here and Vundle is used to manage the plug-in. In some configurations on the internet, Vundle configuration is often placed at the end of the configuration file, which is incorrect. The Vundle configuration must be placed at the beginning. (If you do not need Vundle, you also need to put the configuration at the beginning with the Pathogen plug-in .) This is because Vim will arrive only after the Vundle plug-in is running ~ The/. vim/bundle directory loads other plug-ins. If Vundle does not run first, Vim certainly cannot find the downloaded plug-in.

Lines 18th to 44, for example, the figure captured in GVim, by the way, shows the effect of GVim:

Rows from 45th to 68:

Lines 69th to 86:

It can be seen that my configuration file is very simple, and the various settings are slightly divided into classes, and simple annotations are made. This configuration file only provides the most basic settings for Vim. It does not contain any keyboard ing or script code. I have used different color schemes for Vim and GVim. Vim uses the classic desert, while GVim is a popular solarized on the Internet, in addition, the color scheme is automatically downloaded using Vundle.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • 3
  • 4
  • 5
  • Next Page

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.