Getting Started with vim

Source: Internet
Author: User

    • Vim Normal

.: Repeat Last Command 0: (note is number 0) cursor moves to the current line  $: Cursor moves to the end of the current row  ^: Jumps to the first non-whitespace character h: The cursor moves left one character  l: The cursor moves right one character  j: The cursor moves down one character &NBSP;K: Cursor up one character   k:help  i:  i before cursor:  a at current start: After cursor  a: At current line end  o: New line below current line  o: New line  s: Delete current character, change to insert mode CC or C or S: Delete current line, change to insert mode ~: Flip case GG: To file Top G: To end of file Guu: The current line is converted to uppercase Guu: The current line is converted to lowercase g~~: Current line Flip Case W or w: The cursor moves right one word to the first  b or B: The cursor moves left one word to the first  e or E: The cursor moves right one word to the end of the word &NBSP;FX: Moves the cursor to the next X in the current line. Obviously, X can be any one letter, and you can use it; To repeat your last F command. TX: Similar to the above command, but moves to the left of X. (This is really useful) Fx: Like FX, it's just looking backwards. Use to repeat the previous F command. TX: Similar to TX, but moves back to the right-hand position of X. %: Jump cursor between matching parentheses  ctrl+f: Flip a screen to the end of the file  Ctrl+b; flip one screen to the top of the file  u undo.  p: Paste very simple D: clip the contents of the selection to the Clipboard. Y: Copies the selected content to the Clipboard. DD: Cuts the current line. YY: Copies the current line. R replaces the current character R replaces the current character in the current line with its following part  >> current line increment indent << current line Decrease Indent  ndd: Cut the current line and its n-1 row  nyy: Copy the current line and its subsequent n-1 rows  ngg or ng: Jumps to N rows: N jumps to n rows NH: Cursor moves left n rows  nl: Cursor shifts n rows  nj or n+: Cursor moves down n rows  nk or N: Cursor up n rows   n$: Cursor moves to end of Nth line  ns: Remove n characters to insert mode NCC or NS or NC: delete n rows, change to insert mode nu: Undo N Operations Nr: replaces the current character in the current line and its n-1 character as an input character NW: Moves to the beginning of the nth word on the right &nbSp;dw or de: Deletes the current byte in the current word and its back part CW or CE: Deletes the current byte in the current word and its following part, and becomes insert mode  d2w or D2E: Deletes the current byte in the current word and its following part and the next word c2w or c2e: Deletes the current byte in the current word and its following and the next word, and becomes the insert mode  dawcaw These two are  yw or vwy for the entire word: Copy the current byte in the current word and the part behind it yaw copy the current whole word   q: : Open command History    /text: Searches for the string text from the current cursor and arrives where text appears. You must use carriage return to start this search command. If you want to repeat the last search, press N to move to the next text and N to the previous text. #: Look up the current word *: Look down the current word   
    • Vim Visual
VG: Check the current line and all rows below it VGG: Select all rows in the current row and its top VAW or Vboe Select the current word vbb o e xml tag using Vit, check the contents of the tag after you select, D, delete the selected section after select, R, Replace all selected characters with the character selected below to enter the selection area, O, at the start and end of the selected range jumping cursor vr-, replace all characters of the current line as-ctrl+v: Adjust cursor start Rectangle Select v Highlight n line: ' <, ' > m A Moves the selected text to a line after it executes a;<esc> jumps to the next line, executes the VG: ' <, ' > normal. So that all the remaining lines are there; executes a;<esc>:%normal on a line. The end of all lines of the full text are added; :%normal A; the end of all lines of the full text are added; :%normal i//(capital I) Add//To the beginning of all lines of the full text
    • Vim command
: then enter the command 2,5p print line 2nd to 5th%s/s1/s2 Replace the first s1 of each line with s2a m b to move line A to line B, and the original a+1 line to line B. Move line A to the current line. MB moves the current line to line B ATB will copy line A to B +1 lines, the original b+1 line and all the lines below it fell one line at. Copy Line A to the bottom of the current line. TB copies the current line to line B below the command half ctrl+d prompts Col ctrl+dcolorscheme ctrl+d Normal mode @: After executing the last Command mode command, use @@ 重复 repeat: 22,26 normal A; line 22nd to Line 26th at the end of the add; : The normal plus command executes the command in normal mode: Then view the history command up: Shell pull shell
    • VIM Multi-file

Vim *.py using VIM to open multiple py files: LS View open background file: Buffer n open nth buffer pool ctrl+^ Toggle Edit file: Bnext:bpre:bfirst:blast:bdelete N1 n2 N3 Delete buffer : 2,4 bdelete Delete buffer 2,3,4:args View the parameters passed to vim: args index.html Add a new parameter to Vim, which allows you to open another file: Args ' cat record.txt ' Add the file name in the Record.txt file to vim and open the file name in Record.txt in the current vim

Getting Started with vim

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.