Vim common commands and transformation to IDE

  
 

Enter the vi command vi filename : Open or create a new file, and place the cursor on the first line first vi +n filename : Open the file and place the cursor on the nth line first vi + filename : Open the file and Place the cursor on the last line first vi +/pattern filename: Open the file and place the cursor on the first string matching pattern - vi -r filename : System crash occurs when editing with vi last time, restore filenamevi filename. ...filename : Open multiple files, edit them in turn

Move cursor class command h: Move the cursor one character to the left l: Move the cursor right one character space: Move the cursor right one character Backspace: Move the cursor one character to the left k or Ctrl+p: Move the cursor up one line j or Ctrl+n: Move the cursor down one line Enter: Move the cursor down one line w or W: Move the cursor right one word to the beginning b or B: Move the cursor one word to the beginning of the word e or E: Cursor moves one word j to the end of the word): Cursor moves to the end of the sentence (: Cursor moves to the beginning of the sentence}: Cursor moves to the beginning of the paragraph {: Cursor moves to the end of the paragraph nG: Cursor moves to the beginning of the nth line n+: The cursor moves down n lines n-: the cursor moves up n lines n$: the cursor moves to the nth line Tail H: The cursor moves to the top line of the screen M: The cursor moves to the middle of the screen. L: The cursor moves to the last line of the screen. 0: (Note that the number is zero) The cursor moves to the beginning of the current line. $: The cursor moves to the end of the current line.

Screen roll-down command Ctrl+u: Turn the file to the first half of the file Ctrl+d: Turn the file to the end of the file half-screen Ctrl+f: Turn the file to the end of the file Ctrl+b; Turn the file to the first screen nz: Will be n The line is scrolled to the top of the screen, and the current line is scrolled to the top of the screen without specifying n.

Insert text class command i: Before the cursor I: At the beginning of the current line a: After the cursor A: At the end of the current line o : A new line is opened under the current line. O: A new line is opened above the current line. r: Replace the current character R: Replace the current character and the following characters until the ESC key s: Start from the current cursor position to enter The text replaces the specified number of characters S: deletes the specified number of lines and replaces the ncw or nCW with the entered text: modify the specified number of words nCC: modify the specified number of lines

delete the command ndw or ndW: Delete the n-1 words at the beginning of the cursor and the following: delete to the beginning of the line d$: delete to the end of the line ndd: delete the current line and then n -1 line x or X: delete a character, x deletes the cursor, and X deletes the Ctrl+u before the cursor: deletes the text entered in the input mode

Search and replace command: /pattern: from At the beginning of the cursor, search for pattern at the end of the file? pattern: search for patternn from the beginning of the cursor to the beginning of the file: repeat the last search command in the same direction N: repeat the last search command in the reverse direction: s/p1/p2/g: will be current All p1 in the row are replaced by p2: n1, n2s/p1/p2/g: replace all p1 in the n1 to n2 rows with p2: g/p1/s//p2/g: all p1 in the file Replace with p2

Options set all: List all option settings term: Set terminal type ignorance: ignore case in search: display tab stop (Ctrl+I) and end-of-line flag ($) Number: display line number report: display the number of traces modified by line-oriented commands: display short warning message warn: display NO write information if you do not save the current file when you transfer to another file: allowed in search mode , use the special character nowrapscan without "&"quo;\\" to prevent vi from reaching in the search At both ends, start mesg from the other end: Allow vi to display information written by other users to write to their own terminal.

Last line mode command: n1, n2 co n3: n1 line to n2 line Copy the contents to the n3th line: n1, n2 m n3: Move the contents between the n1 line and the n2 line to the n3th line: n1, n2 d: delete the content between the n1 line and the n2 line :w : save the current file: e filename: open the file filename for editing: x: save the current file and exit: q: exit vi:q!: do not save the file and exit vi:!command: execute the shell command command:n1,n2 w!command: The contents of the n1 line to the n2 line in the file are input as command input. If n1 or n2 is not specified, the entire file content is used as the input of the command: r!command: the output of the command command will be output. Put it on the current line. #################:w Filename-->Save the current file with this file name http://www.diybl.com/course/6_system/linux/Linuxjs/2007114/84125_3.html When installing to taglist, unzip zip can be used: unzip can also be manually decompressed in the source code directory $ctags -R generates tagsctrl +] can jump to the definition and so on. . Jump. Ctrl+t can be returned. Vim command: Tlist open the label (first here) cscope -Rbkq can generate cscope relation file.

You can then view the corresponding function definition or file, ctrl+t returns. : cscope find g print: cscope find f cstest.h


where cscope.out is the basic symbolic index, and the last two files are generated using the "-q" option. Speed ​​up the indexing speed of cscope. The parameters of the above command have the following meanings: -R: When generating the index file, search for the code in the subtree -b: Only generate the index file, do not enter the interface of cscope -k: Do not search /usr/when generating the index file Include directory -q: Generate cscope.in.out and cscope.po.out files to speed up cscope indexing -i: If the file name of the saved file list is not cscope.files, you need to add this option to tell cscope where to find A list of source files. You can use "-" to indicate that a list of files is obtained from standard input. -I dir: Find the header file in the directory indicated by the -I option -u: Scan all files and regenerate the cross-index file -C: Ignore case when searching -P path: before the file represented by the relative path The path, so you can use it without switching to the directory where your database files are located.

:cs find + xialie parameters

s: Find C language symbols, that is, find function names, macros, enumeration values, etc. where g: lookup functions, macros, enumerations, etc. The location, similar to the function provided by ctags d: Find the function called by this function c: Find the function that calls this function t: Find the specified string e: Find the egrep mode, equivalent to the egrep function, but the search speed is much faster : Find and open files, similar to vim's find function i: Find files containing this file



Copyright © Windows knowledge All Rights Reserved