qa = start recording a macro in register aq = end recording@a = replay macro in register a:e ?lename = edit a ?le in a new buffer:bn = go to next buffer:bd = delete a buffer (close ?le):sp fn = open a ?le in new buffer and split windowctrl-w s = split windowctrl-w w = switch windowsctrl-w q = quit a windowctrl-w v = split windows vertically:tabe fn = edit ?le in new tabgt = next tabgT = previous tabs:tabr = First tab:tabl = Last tab:tabm [N] = move current tab after tab N:w = save:wq = save and quit:x = save and quit:q = quit, but failed if unsaved:q! = quit/pattern = search for pattern?pattern = search backwards for patternn = repeat search in same directionN = repeat search in opposite direction:s/old/new/g = replace all old throughout ?le:s/old/new/gc = replace all old with new and con?rm each onev = start visual modeV = start linewise visual modectrl-v = start blockwise visual modeo = move to other end of marked areaU = upper case of marked areaO = move to Other corner of blockaw = mark a wordab = a block with parens (braces)aB = a block with brackets (curly braces)ib = inner () blockiB =inner {} block> = shift right< = shift lefty = yankd = delete~ = switch casedd = delete (cut) a linedw = delete the current wordx = delete current characterX = delete previous characterD = delete to end of lineyy = yank (copy a line)2yy = yank (copy) 2 linesyw = yank wordy$ = yank to end of linep = put the clipboard after cursor/current lineP = put the clipboard before the cursor/current line]p = put the clipboard at the proper indentation\CommandsMarking TextTab Commandsctrl w - window commandsMacrosh,j,k,lctrl-f = page upctrl-b = page down% = jump to matching bracew = jump to end of words (punctuation)W = jump by wordse = jump to end of words (punctuation)E = jump to end of wordsb = jump backward by words (punctuation)B = jump backward by words0 = start of line^ = ?rst character of line$ = end of linegg = go to ?rst linegd = go to def of the function or var under the cursor[N]G = go to line N or last linefx = move the cursor forward to the next occurrence of character x on the current line; = repeat last f commandtx = like fx but move right before the characterMulti-FileCursor MovementExitingFx = move the cursor backwards to the next occurrence of x) ,(= move the cursor to next, previous sentence* = Read the string under the cursor and go to next occurrence# = same as * but goes to previous occurrence`. = Go to line last editedH = move the cursor to the Highest line on the screenM = move the cursor to the Middle of the screenL = move the cursor to the Lowest line of the screenma = Make a bookmark name a at the current cursor positionBookmarks`a = Go to bookmark a (backtick, not single quote)Search/ReplaceScreenwisei = insert mode at cursorI = insert at the beginning of linea = append after the cursorA = append at the end of the lineo = open blank line below current lineO = open blank line above current lineEsc = exit insert modectrl-n = next completionCompletions (type a few chars then)r = replace a single character (!insert mode)J = join line below to the current linecc = change an entire linecw = change to the end of wordc$ = change to the end of lines = delete character at cursor and substitute textS = delete line at cursor and substitute textxp = transpose to lettersu = undoctrl-r = redo. = repeat last command~ = switch caseg~iw = switch case of current wordgUiw = make current word uppercaseguiw = make current word lowercase>> = indent line one column right<< = indent line one column left== = auto-indent current linectrl-p = previous completionInsert ModeVisual ModeEditingCut and PasteVim Commands and ShortcutsBy: Joe Martinez http://jrmiii.com @capitalist
Vim基本操作思维导图



