Vim Command Quick Check

Source: Internet
Author: User
Tags first string tagname

Order Quick Check Card (i)

Order Quick Check Card (ii)

Vim Open command

    • Vim filename-Opens the file filename and places the cursor at the beginning of the first line
    • Vim +n filename-Opens the file filename and places the cursor at the beginning of nth
    • VIM + filename-Opens the file filename and places the cursor on the last line
    • Vim +/pattern file-Opens the filename and places the cursor at the first string in the pattern match
    • Vim–r filename--restore filename after a system crash with the VI edit filename
    • Vim File1 ... Filen--Open multiple files and edit them in turn
    • Vim-o File1 ... Filen--Open multiple files and edit them in a horizontally delimited manner
    • Vimdiff filename1 filename2--Open two files in a vertical split filename1,filename2 and then show a different comparison of two files
Insert mode

Vim completion

    • <c-a>-Repeat the last edit action
    • <c-x><c-l>-Full line completion
    • <c-x><c-n>--based on keyword completion in the current file
    • <c-x><c-k>--Based on dictionary completion
    • <c-x><c-t>--based on synonym dictionary completion
    • <c-x><c-i>--based on key word completion in header file
    • <c-x><x-]>--based on label completion
    • <c-x><c-f>--Full file name
    • <c-x><c-d>--Complement macro definition
    • <c-x><c-v>--Full VIM command
    • <c-x><c-u>--user-defined complement method
    • <c-x><c-s>--Spelling suggestions
Normal vs. command-line modeMoving

Ctags shortcut keys

    • [{--Go to the previous ' {' In the first column
    • }]---go to the next "{" In the first column
    • {--go to the previous empty row
    • }--Go to the next empty line ([and] are also two instructions respectively)

Move cursor

    • H--Right
    • J--Down
    • K--upward
    • L--Left
    • 0-This is the number "0": Move to the front character of this line
    • ^--moves to the beginning of the line at the first character
    • <c-p>--Move the cursor up one line
    • <c-n>--Move the cursor down one line
    • num+--The cursor moves down to the N outfit, without the n cursor moving to the downward line
    • num---The cursor moves to the N outfit, if no n cursor moves to the upstream outfit
    • num$--The cursor moves down to the end of N line, and if no n moves to the end of the bank.
    • Num<enter>--Move n rows down, no n move line
    • H--The cursor moves to the top of this screen which line
    • M--The cursor moves to the center of the screen which line
    • L--The cursor moves to the bottom of this screen which line
    • NG--N is a number. Moves to the nth row of this file. If no n is moved to the last row
    • GG--Move to the first line of this file, equivalent to 1G

Screen scrolling

    • <c-f>--screen "down" to move one page, equivalent to <page down> button
    • <c-b>--screen "up" to move one page, equivalent to <page up> button
    • <c-d>--screen "down" move half page
    • <c-u>--screen "Up" move half page
    • <c-e>--Scroll down one line of the screen
    • <c-y>--rolling a line on a screen item
    • NZ-Rolls the nth line to the top of the screen. Rolls the current line to the top of the screen when n is not specified
    • : $--scroll to the last line of the article
    • : 0--screen scroll to the beginning of the article line

Jump

    • w/w-the cursor moves right one word to the beginning of the word.
    • b/b--the cursor moves left one word to the beginning of the word.
    • e/e--the cursor moves right one word to the end.
    • (--the cursor moves to the beginning of the last sentence.)
    • )--the cursor moves to the beginning of the next sentence sentence.
    • {--the cursor moves to the beginning of the previous paragraph sentence.
    • }--the cursor moves to the beginning of the next paragraph sentence.
    • F[char]--the cursor jumps to the next character Char at the bank (Char refers to any character)
    • F[char]--the cursor jumps to a character char at the bank (Char refers to any character)
    • T[char]--the cursor jumps to the first character of the next char of the bank prompt (char refers to any character)
    • T[char]--the cursor jumps to the last character of Char on the line prompt (char refers to any character)
    • /[word]--the cursor jumps to the next string word and highlights all word words (Word refers to any string and can use regular expressions)
    • ? [Word]--the cursor jumps to the previous string word and highlights all word words (Word refers to any string, and you can use regular expressions)
    • #--the cursor jumps to the next word with the same word as the cursor and places all the The same word highlights
    • *--the cursor jumps to the last word with the same word as the cursor, and highlights all the same words as the cursor where
    • GD--all the words with the same word at the cursor are highlighted. And jump to the last highlighted word
    • GD--highlight all words with the same word as the cursor, and jump to the first highlighted word
    • '.--Jump to last edit position
    • ' C--move cursor to bookmark c At (c is any character)
    • N--the next match (or the next, if yes/search), the search is the next, but in fact it will only toggle in the highlighted characters
    • N--Previous match (IBID.)
Operation

Insert operation

    • Row operations
      • I--Insert text at the beginning of the cursor
      • A--Add text at the end of the line where the cursor is located
      • O--Add a row below the line where the cursor is located
      • O--Add a row above the line where the cursor is located
      • NS-from the current line, delete the next n rows and enter edit mode, without n deleting the current row and entering edit mode
    • Character manipulation
      • I--insert text before the cursor
      • A--insert text after the cursor
      • R--Replaces the character at the cursor, ends the substitution
      • R--Replace multiple characters to press [ESC] key flag to replace end
      • NS-starts at the current cursor position, deletes n characters and enters edit mode, without n deleting one character and entering edit mode
      • : R [FileName |!cmd]--Reads a file content data or a command's return result in the editing data, and adds the data to the line following the cursor

Copy and delete and paste

    • Character manipulation
      • NX--Remove n characters backwards if no n deletes one character backwards
      • NX--Remove n characters forward, without n deleting one character ahead of the other
      • D0--that is 0 of the number, delete the cursor where it is, and the first character of the line
      • d$--Deletes the cursor where the last character of the row is
      • Y0--Copy the character that contains the cursor to all data at the beginning of the line
      • y$--Copy all data that is the character of the cursor to the end of the line
      • P--Paste the copied data in the next column of the cursor
      • P--Paste the copied data in a column on the cursor
    • Row operations
      • NDD--Removes the column with the cursor in the down n column, if there is no n delete the row where the cursor is located
      • DnG-Deletes all data on the nth row of the cursor, without n deleting all data from the last row of the cursor
      • Nyy-The row where the cursor is copied, if no n is the row that contains the copy cursor
      • Yng--Copy all data from the column to row N of the cursor, without n all data from the row to the last row where the cursor is copied
      • J-Combine data from the cursor column and the next column into the same column

Undo and Redo

    • . --Repeat the previous action
    • U--Restore previous action
    • <c-r>-Redo Last action

Block operations

  • Enter marker text mode
    • V--Enter marker text mode, single character mode
    • V-Enter marker text mode, line mode
    • <c-v>--Enter tag text mode, column mode, similar to UE's column mode
  • Select a region in the tagged text mode
    • AW-Select a word with a space after the word
    • As--Select a sentence with a space after the period
    • AP--Select a paragraph with a space behind the paragraph
    • AB--check () all contents in brackets, including ()
    • AB--Selects all contents in {} brackets, including {}
    • IW--Select a word without a space after the word
    • IS--Select a sentence without a space after the period
    • IP--Select a paragraph with no trailing spaces
    • IB--Check () the contents of () brackets, excluding ()
    • IB--Check the contents of {} brackets without {}
  • Move cursor position in tagged text mode
    • O-The jump between the diagonal of the cursor in the selection area
    • O-The jump between the horizontal and vertical cursor in the selection area
    • In V and <c-v> mode we can move the cursor position (not all but some of them) by moving the cursor position in addition to the o,o to move the cursor position.
  • Data manipulation in tagged text mode
    • ~--Flip the contents of the selected block in case
    • U--turn the contents of the selected block into lowercase
    • U--Turn the contents of the selected block into uppercase
    • Y--Copy the contents of the selected block
    • d/d/x/x--Delete the contents of the selected block

Row move operation

    • >>-Move the current line one unit to the right
    • <<-Moves the current line one unit to the left (one tab character)
    • = =-Automatically indent as you go forward
    • : N1,N2 CO N3--Copy the contents of the N1 line to the N2 row below the N3 line. If none ", N2" copy N1 to N3 line
    • : n1,n2 m M3--Move the contents of the N1 row to the N2 row below the N3 line. If none ", N2" moves the N1 content to the N3 line
    • : N1,n2 D--delete the contents of N1 rows to N2 rows, ", N2" deletes the N1 rows
    • : n1,n2 y--Copy the contents between N1 rows to N2 rows, ", N2" to copy N1 rows

Character substitution

    • : [Range]s/{pattern}/{string}/[flag] [count]
window

The command to open the window follows several

    • Open Label
      • : Tabe Label Signature
    • Horizontal cutting window
      • : New window name (file name after saving)
      • : Split window name (can also be abbreviated as: SP window name)
    • Portrait cutting window Name
      • : vsplit+ window name (can also be abbreviated as: vsp+ window name)

Window switch

    • <c-w>[h | j | k | l |←|↓|↑|→]

Move window

    • <c-w>t--Move the cursor to the top window
    • <c-w>b--Moves the cursor to the bottom of the window

Ctags

Window resizing

    • Longitudinal adjustment
      • <c-w>+--vertical expansion (increase in number of rows)
      • <c-w>---Vertical narrowing (decrease in number of lines)
      • : res (ize) Num--For example:: Res 5, display row number adjusted to 5 rows
      • : Res (ize) +num--Adds the current window height to num rows
      • : Res (ize)-num--reduces the current window height by num rows
    • Transverse adjustment
      • : Vertical res (ize) num Specifies that the current window is num column
      • : Vertical res (ize) +num add num column to current window
      • : Vertical res (ize)-num reduces the current window to NUM columns

Multi-window operation

    • : QA (LL)--exits all windows, but if you have a window that has been rewritten but not saved Vim will not exit
    • : WA (LL)--Save All modified windows
    • : Wqall--Save all modified windows and close, then exit vim:qall! Force exit all windows, and then exit vim
    • : Argdo [Command]--executes the command followed by Argdo for all the Windows to be edited
    • : Only-a window other than edit, but if the text in those Windows has been rewritten and not saved then the operation will fail

Vim Multi-text editing

    • : N Edit Next file
    • : N Edit Last File
    • : Files lists all the files that are currently open for this vim

Save and exit

    • : Q--exit Vim to return to the shell, if any changes are not saved, VI gives a hint in the last row does not exit vim to the shell
    • : q! --Exit Vim to return to the shell, discard unsaved changes
    • : X--Save and exit, if the file is not modified, do not update the file modification time
    • : W--Write the edited data to the hard drive
    • : w! --Force the file to be written if the file property is read-only
    • : w filename--Writes the current file to the filename file
    • : n1,n2 w filename--Saves the contents of N1 to N2 in the filename file
    • ZZ-If the file is not changed, do not save leave, if the file has been changed, then save and leave

Hexadecimal view Text class capacity

    • :%!xxd--View current file by hexadecimal
    • :%!xxd-r--Return to normal mode from hexadecimal
plug-in shortcut keys

Tag shortcut keys

    • <c-]>--Jumps to the label of the word under the current cursor
    • <c-o>--Return to previous label
    • <c-t>--Return to previous label
    • <c-w>]--A new window displays the label of the word under the current cursor, and the cursor jumps to the label
    • : Tag TagName--Jump to TagName tab
    • : Stag TagName--New window displays TagName tab, cursor jumps to label

Omnicppcomplete
When the AutoComplete drop-down window pops up, some of the shortcut keys are available:

    • <c-p>--Switch members forward
    • <c-n>--Switch members backwards
    • <c-e>--Indicates exiting the drop-down window and returning to the original input text
    • <c-y>--Indicates exiting the drop-down window and accepting the current option

Winmanager

    • <enter>--or double-click if the cursor is a directory, enter the directory; If the file is under the cursor, open the file
    • <tab>-If the cursor is a directory, enter the directory; If the file is under the cursor, open the file in a new window
    • <F5>--Refresh List
    • ---return to the previous level directory
    • C--Make the browse directory a vim current working directory
    • D--Create a directory
    • D--Delete the directory or file under the current cursor
    • I--Toggle display mode
    • R--File or directory rename
    • S--Select Sort method
    • R--Reverse sort list
    • X--Customize the browsing method to open the file using the program you specified
Miscellaneous

Bookmark

    • MC--Record the current position as a bookmark C (c is any character) when a label of multiple locations is the same, only the last defined position label will take effect
    • ' C--move the cursor to bookmark C (c is any character)

Execute shell command

      • : SH--open shell, execute shell command, enter exit to exit Shell and return to VIM
      • :!cmd--execute shell directly (CMD is represented as any shell command)

Vim Command Quick Check

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.