Sunday, January 16, 2011

Dialogue on UNIX: new improved Vim editor

Line mode despite the extensive use of is command and insert mode, but the line is just as important, but sometimes is not fully understand and use.

Line mode to enter the line editor that allows you to one or more rows on processing the command. Taking into account the ex editor vi to named, so it only fits into the ex editor line mode. From the command line mode mode to enter, enter a colon (:). Then move the cursor to the lower-left corner of the window. Continue to enter, all the text appears in the colon at the bottom of the window. Click Enter to begin the calculation and execution of line mode command. If you decide not to perform in line mode input rows, click Escape to return to command mode. Use the editor of line mode, remember two command style. First, enter the command, vi or Vim command execution. as is If the executed command and modify data, the current row is the goal. However, using the second method provides the number of rows to process the specified rows. To enter, use a colon to enter the number of rows to be processed or row range, with a comma (,) to separate the start and end range. For example, if a row only, then the command to 23: 23. If you want to modify 2319 to the line between 3819, you enter: 2319, 3819. To start from row 45 to file a command to the end, you need to last row of parameter to be replaced by a dollar sign ($), namely: 45, $. This command is only available in line mode perform most basic command:: w: write a file to disk. If you supply a parameter, the editor attempting to write data. Note: If you supply a parameter , and there, the editor does not overwrite the existing file data. :w! : Writing files to disk and overwrite all data in the file. : , W: from will to write between rows. : Q: try to not save exit Editor. Note: If the data has been modified, you need to first save the file and then exit the editor, otherwise it will cause the file has not been saved. : Q!: exit the editor, not a file is written to disk. : N: If you edit multiple files, first edit to edit the list of the next file. : E : Edit. : E #: If you edit two files, switch between the two files. : /S//: current line replaces the first appears. : 1 , $ s//g/: start from row 1, in the entire file implementation, use replace all. : R : will read into the current editor session. : , D: from to delete rows. : , Y: from to replication between rows. Vi and Vim differences in spite of the vi and Vim will look the same, but they do exist. The following are the two powerful text editor a few differences between: vimscript: Vim uses an internal scripting language that allows complex script vimscript will expand functionality added to the editor. In addition to vimscript, Vim also supports Perl, Python, Ruby, Tcl, and other languages. Vimdiff: will a useful command is called vimdiff and Vim packages bundled together. Use vimdiff can display multiple adjacent to each other, similar to the sdiff, as shown in Figure 6. Figure 6.vimdiff example

No comments:

Post a Comment