Alibabacloud.com offers a wide variety of articles about difference between vi and vim, easily find your difference between vi and vim information here online.
Vi and vim Editor (9): Global replacement (2)
The previous article has learned how to use the ": s" command in the vi editor to perform global replacement. In addition, you can use regular expressions in the replacement command to perform powerful pattern matching. This article will learn more examples of pattern matching to become more familiar with regular expr
You can use the: s command to replace a string in Vi/vim. The command has a number of different details of how to use the method, you can implement complex functions, record several here, convenient later query.: s/vivian/sky/replaces the current line the first Vivian is sky: S/vivian/sky/g replaces the current line all Vivian are sky: N, $s/vivian/sky/replaces the first Vivian of each row in the nth row to
simpler way of writing:This command replaces the line start (^) with a "//", "^" for the beginning of a line (this is a logical concept, not the actual character, so the actual beginning of the character is not actually replaced).(11) Add a period to the end of all lines of the file:":%s/$/./".(12) Reverse the order of all hyphens separated parts:(13) All the words in the file are capitalized:":%s/.*/\u/" or ":%s/./\u/g", but the first command will be faster.(14) Reverse the order of the lines
Today on the Internet to see a article about Vim feel great, just record down to learn!VIM/VI IntroductionVim/vi is a powerful full-screen text editor, which is the most commonly used text editor on Linux/unix, and its role is to create, edit, and display text files.1. Create a command, create a file such as #
VI (VIM) is a very common code Editor on Linux, many Linux distributions are installed by default VI (VIM). VI (VIM) command a wide range but if used flexibly will greatly improve the efficiency.
Sometimes when we use Vi/vim to edit the file if you do not notice the file permissions, when the last time the Save may prompt the following error, if forced to quit and then switch users, will certainly lose the current changes, below I will give you a way to not quit saving files.1. Then vi/vim the editor into the c
Vi/vim Keyboard Diagram-----Another desktop background good pictureMaybe there are a lot of people who are not willing to use the CLI vi/vim to write things, but when you really get used to it, its efficiency is immeasurable. The following picture, a look to understand, from now on, learning becomes no longer difficult
Before introducing the Nano editor, Vi/vim is more powerful in functionality, so it is common to write scripts using the Vi/vim editor. Vim adds a more friendly editing interface to the VI and makes it easier to find errors.It can
1 Vi/vim keyboard diagram2 text commentary6 ways to enter edit mode:I insert before the cursorI insert at the beginning of the lineA after the cursor is insertedA inserts at the end of a rowo Insert in next lineo Insert in previous lineDelete characterX Delete Current characterX Delete the previous characterRow operationsDD Delete When moving forward5DD counting from the current line, deleting 5 rowsYY copy
Vi/vim Common Commands
Command mode
Cursor movement
h or left ARROW key
The cursor moves one character to the left
J or DOWN ARROW key
Move the cursor down one character
k or up ARROW key
Move the cursor up one character
l or right ARROW key
The cursor moves one character to the right
Ctrl+f
Scr
Change the TAP key unitVi/vim Editor By default, tap is relative to 8 spaces each time it is pressed.(1) Temporary changesAfter opening the file with VI, enter the following command:: Set tabstop=4Command interpretation: Change to the equivalent of four spaces.(2) Permanent changesThat is, change the configuration file for Vi/vim.Add the above command in the. vim
Basically, Vi/vim is divided into three modes, namely, General mode, edit mode and command-column mode. The three modes of action are:
General mode:Open a file with VI directly into the general mode (this is the default mode). In this mode, you can use the "up or down" button to move the cursor, you can use "delete character" or "Delete whole line" to pr
Label: style blog color use the DIV code of the strong FileBecause the newly installed Vim/VI does not enable the code highlight configuration by default, we can see that some friends go online again and again to find various configurations. In fact, VIM only copies the configuration file samples by default.
In the user root directory (~) Create a
Tags: body character visual mode comm requires mouse command call1. Vim has a total of 4 modes:
Normal Mode (Normal-mode)
Insert mode (Insert-mode)
Command mode (Command-mode)
Visual Mode (Visual-mode)
Normal modeThe default is in normal mode when Vim is started. No matter what mode you are in, pressing the Insert modePressing I, I, a, a etc in normal mode will enter insert mode. Now just r
Vim Install yum install-y vimVim View basic information vim--versionVim Open and new file vim [filename]Vim operation after entering the fileNote: There are several modes of vim first1, shortcut key mode: Vim can only move the cur
, and when you enter "4j", the VI editor displays the following:Then enter the sort command. It can be found that filter text with VI in fact, or through the ex to filter the text (vi editor using the bottom editor is the ex Line editor). In addition to using this command, you can also use "!5!sort", where the second exclamation point represents the meaning of th
"." and repeat the previous command directly.Undo command:as mentioned earlier, you can use the "u" command to undo the last action when an error occurs. " u "command can undo all edits to the same line , but it requires the cursor to be in this line, and once the cursor leaves the line, you cannot use the U command to restore the original line. More ways to insert text:The previous article has said "I" and "a" two commands to insert text, in fact there are several commands to insert text:
the line where the cursor is located r: consecutive substitution of the cursor character, Until you press the ESC key esc: Exit edit mode, go back to command line mode Commands available in instruction-column mode:: w: Writes edited data to the hard disk file: w!: Force write to file, in the end can write with your own permissions on the file about: Q: Leave VI: q!: Forced leave, such as modified file, will not take effect: Wq: Save exit: w
why to use VI.
VI is a very unfriendly text editor, but why use it. Because: all Unix like systems will build a VI editor, and other text editors are not necessarily present; a lot of the editing interfaces of the software will call VI Vim's ability to edit the program, and it can be used to identify the correct chara
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.