Vim an advanced text editor

Source: Internet
Author: User
Keywords Text Editor text insert can execute
Tags advanced aliyun development development environment document editor environment file

Vim is an advanced http://www.aliyun.com/zixun/aggregation/18444.html "> text editor that provides the functionality and refinement of the UNIX editor ' Vi '. Vim is often considered a "Programmer's editor," and she is useful when writing a program that many people consider to be a complete integrated development environment (IDE). In this case, VIM is not just for use by programmers. Vim can be used in a variety of document editing, from email typesetting to configuration file writing.

This article will show you how to install vim and brief it.

Install Vim

The console version of Vim is released with Ubuntu, so there is no need to install it. However, if you prefer vim under the GUI interface, please install the VIM-GTK package again or enter it in the terminal:

sudo apt install vim-gtk

Quick Guide

Vim needs to learn a lot of things. However, if you are familiar with VIM, you can use Vim's advanced features to manipulate the text very skillfully.

You can enter VIM in the terminal to start Vim in console mode or enter Gvim to start vim in graphics mode. A blank screen with vim information appears after you enter. However, entering any text in that state will fail! So here are some features that many beginners will confuse:

Mode

One of the most confusing features of Vim is that she has 3 models.

Insert mode: Input text
Edit mode: Executes the command, also known as normal mode.
Command mode: Execute colon command

The insert mode is not the default mode, you must press I to enter insert mode and enter some text on the screen. Press the <Esc> button to move from insert mode to edit mode. This pattern is used to move and manipulate text, sometimes in very interesting ways. Command mode is used to execute colon commands, such as Save, find/Replace, and configure Vim. To save the text, you only need to enter in normal mode: Enter command mode and enter: W Filename<enter> Quit vim execute the colon command: Q. Summarized below:

Vim (start vim)
I (enter insert mode)
< input text >
<Esc> (back to edit mode)
: w filename (save file as ' filename ')
: Q (Quit VIM)
Vim filename (Open the file you just saved in vim)

Keep in mind that the best way to learn vim is to use her. You can use the built-in VIM tutorial to learn the basics of vim by simply typing vimtutor in a terminal (some systems may be vim-tutor).

Edit DocBook document with Vim

In order to submit an article to an Ubuntu document organization, you need to use the DocBook format. You may be interested in the Vim file type plug-in xmledit.

Add the following to ~/.VIMRC

map! , e <emphasis>
map! , P <para>
Map <F3> v/>^mx

If the cursor is at the top of an open XML tag, you can press F3 to cut the contents of the tag to a buffer. Move the cursor to the bottom of this section and press ' P ' (= paste) The content just copied appears after the current character. This is useful for tagging documents that have already been written. A typical use is to add formatting to documents that are copied/pasted from a Web page when needed.

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.