Linux Common Commands--vi/vim

Source: Internet
Author: User

vim 存文本编辑器

Syntax format: VIM "option" "File" vim [options] [file]
Attention:
1.vim command and subsequent options and files, there must be at least one space between each element
2.vim can be divided into three modes: normal mode, edit mode, command mode.
Vim three modes of conversion
Several ways to open vim
1.vim file +n: Open files with cursor at beginning of Nth line, N is natural number
2.vim file +: Open files with cursor at the beginning of the last line
3.vim file +/pattern: Places the cursor at the first pattern-matched string, pattern is any string
Parameter options:

Command Description
/ysg Start at the cursor position and look down for a string named Ysg
? ysg Search for a string named YSG starting at the cursor position
N Start from the cursor position and repeat the previous search action down
N Repeat the previous search move up from the cursor position
I Insert text at the current cursor location
Esc Exit edit mode, return to command mode
: Wq Exit and save
: wq! Exit and force save, "!" for mandatory meaning
: q! Force quit, do not save

Case one:
Open a new folder: There will be a word for [new File]
Vim Ysg.txt

Case TWO:
Enter edit mode, press ESC and save exit

Linux Common Commands--vi/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.