Vim is a powerful editor on the Linux platform. It is an enhanced version of the VI editor in the early years. This gvim is for Windows and has a standard GUI for Windows. Therefore, it is called G (graphical) vim. We can understand gvim as a graphical version of VIM (enhanced version of vi). The commands and usage of gvim are the same, so we can test Vim commands. This is an international version. It will automatically select the corresponding language pack Based on the installed platform. It supports Chinese and various encodings, and the interface is also Chinese. Please feel free to use it. This simple is the best editor with Unix characteristics and style will bring you different feelings.
[Historical review]
Vim is a multi-platform text editor developed from VI.CodeConvenient programming functions such as completion, compilation, and error jump are particularly rich.ProgramIt is widely used in combination with Emacs and has become the favorite editor for Unix-like users. Someone once joked that there are only three programmers in the world: Emacs, VI, and other editors.
When the Creator Bram moolenaar purchased his Amiga computer at the end of 1980s, Bram began copying Stevie from an open-source VI because Amiga does not have its most popular editor VI, developed Vim 1.0. The initial goal was to completely copy the VI function, and VIM was short for VI imitation (simulation. 1992 version 1.22 of VIM was transplanted to Unix and MS-DOS. Since then, the full name of VIM has changed to VI improved (improved) due to the increasing number of features. It is now openSource code.
[Function overview]
- It can be fully compatible with the original VI According to Settings
- Multi-buffer editing
- Split windows of any number (horizontal or vertical)
- Script Language with list and dictionary Functions
- You can call Perl, Ruby, Python, TCL, and mzscheme in a script.
- Abbreviations
- Dynamic word completion
- Multiple Undo and redo operations
- Syntaxes highlighted for more than 400 text files
- Automatic reduction of more than 40 languages, including C/C ++, Perl, Java, Ruby, and Python
- Jump using the ctags label
- File recovery after crash
- Save and restore the cursor position and open buffer status (Session function)
- Two files can be differentiated and the diff mode of the synchronization function can be implemented.
- Remote File editing
- Omni completion (context-related completion)
[Working mode]
Vim derived from VI has multiple modes. This unique design can easily confuse beginners. Almost all editors have two modes: insert and execute commands. Most Editors Use a different method than VIM: Command menu (mouse or keyboard driver ), the combination key (usually composed of the control key (CTRL) and ALT key (ALT) or the mouse input. Like VI, VIM only switches between these modes through the keyboard. This allows Vim to minimize the combination of keys without having to perform menu or mouse operations. The speed and efficiency of text reporters or programmers can be greatly improved.
Vim has 6 basic modes and 5 derived modes:
{Basic mode}
Normal Mode
In normal mode, you can execute General Editor commands, such as moving the cursor and deleting text. This is also the default mode after Vim is started. This is exactly the opposite of the operation method expected by many new users (most Editors Use the insert mode by default ).
Most of Vim's powerful editing capabilities come from common mode commands. Common Mode commands often require the end of an operator. For example, the normal mode command "DD" deletes the current line, but the first "D" can be followed by another mobile command to replace the second "D ", for example, you can use the "J" key to move to the next row to delete the current row and the next row. In addition, you can also specify the number of command repetitions, "2dd" (repeated "DD" twice), the effect is the same as that of "DJ. The user has learned a variety of commands for moving/redirecting between texts and other editing commands in common mode, and can flexibly combine and use them, text editing is more efficient than those with no mode.
In normal mode, there are many ways to enter the insert mode. The common method is to press the "a" (append/append) or "I" (insert/insert) Key.
Insert mode
In this mode, most keys insert text to the text buffer. Most new users want to maintain this mode throughout the text editor editing process.
In insert mode, you can press ESC to return to normal mode.
Visual Mode
This mode is similar to the normal mode. However, the move command expands the highlighted text area. The highlighted area can be a character, line, or text. When executing a non-mobile command, the command will be executed to the highlighted area. Vim's "Text object" can also be used in this mode like mobile commands.
Select Mode
This mode is similar to the mode Editor (in Windows standard text control mode ). In this mode, you can use the mouse or cursor key to highlight the selected text. However, if you enter any character, VIM will replace the selected highlighted text block with this character and automatically enter the insertion mode.
Command Line Mode
In command line mode, you can enter the text that will be interpreted and executed. For example, execute the command (":" key), search ("/" and "?" Key) or filter command ("!" Key ). After the command is executed, VIM returns to the mode before the command line mode, which is usually the normal mode.
Ex Mode
This is similar to the command line mode. Multiple commands can be executed at a time before the ": Visual" command leaves the ex mode.
{Derived mode}
Operator wait Mode
In normal mode, VIM waits for an "action" after executing an operation command to complete the command. Vim also supports the use of "Text object" as an action in the operator wait mode, including "aw", "a word", and "as" sentence (a sentence), "AP", a paragraph (a paragraph), and so on.
For example, in normal mode, "d2as" deletes the current and next sentences. In visual mode, "Apu" capitalized all the letters in the current paragraph.
Insert Normal Mode
In this mode, press Ctrl-o in insert mode. Now enter normal mode. After executing a command, VIM returns the insert mode.
Insert visual mode
In this mode, press Ctrl-o in insert mode and start a visual selection. When you select cancel in the visible area, VIM returns the insert mode.
Insert select mode
Generally, this mode is entered by dragging the mouse in the insert mode or using the shift arrow key. When the selected region is canceled, VIM returns the insert mode.
Replacement Mode
This is a special insert mode. In this mode, you can perform the same operations as the insert mode, but each input character overwrites the existing characters in the text buffer. In normal mode, press "R.
{Others}
Evim
Evim is a special GUI mode used to try its best to behave the same way as the "no mode" editor. The Editor automatically enters and stays in the insert mode. You can operate the text only by using the menu, mouse, and keyboard control keys. You can enter "evim" or "vim-y" in the command line. In Windows, you can also click the evim icon on the desktop.
[RelatedArticle]
Gvim Tutorial: Download. Doc gvim tutorial/VI/Vim tutorial]
Gvim command list (image)
-
Gvim graphic keyboard commands
Tree Structure of gvim Command Format explanation
Tip]
For most users, VIM has a steep learning curve. This means that the learning may slow down, but the editing efficiency can be greatly improved once you have mastered some basic operations. To help you learn, VIM provides Vim teaching for beginners. Generally, you can enter "vimtutor" in the Unix Command Line or click the vim teaching icon on the Windows system desktop. The Vim user manual details the basic and advanced functions of vim. Enter ": help user-Manual" in VIM to enter the user manual. In addition to the original English version, the manual was also translated into Chinese by volunteers.
new users should also learn the Vim Help system. You can enter "help" without parameters in VIM to read the Main Help file.