VI Editor Cheat Sheet PDF

Summary

This document is a cheat sheet for the VI text editor. It contains various commands for navigation, insertion, deletion, searching, and replacement within the text.

Full Transcript

VI Editor Cheat Sheet by adzz via cheatography.com/30551/cs/9123/ Controls Inserting Text Searching (cont) :w Save i...

VI Editor Cheat Sheet by adzz via cheatography.com/30551/cs/9123/ Controls Inserting Text Searching (cont) :w Save i Insert before cursor n Go to next match :x or :wq Save & Exit I Insert before line N Go to previous match :q Exit, is no changes a Append after cursor * Search for next instance of current word :q! Exit, ignore any changes A Append after line # Search for last instance of current word :set ic Ignore case while searching o Open a new line after current line Replacing :set noic Case-sensitive searching O Open a new line before current line :set nu Turn on line numbers r Replace one character :s/pt/str/flag Replace pattern with string R Replace many characters :% Replace all old with new Markers s/old/new Deleting Text Flags mc Set marker c on this line `c Go to beginning of marker c line x Delete character to the right of cursor g Replace all occurrences of pattern 'c Go to first non-blank character of marker X Delete character to the left of cursor c line c Confirm replaces D Delete to the end of line & Repeat last :s command dd or Delete current line Navigation :d Other h or Move left :%d Delete all lines  u Undo last change :1,$d Delete lines from beginning of file to j or Move down end of current line U Undo all changes to line  :x,yd Delete lines x through y J Join lines k or Move up ndw Delete the next n words nJ Join next n lines  ndb Delete the previous n words. Repeat last command l or Move right ndd Delete n lines starting with current > Indent  < De-indent w Move to next word Copy and Paste W Move to next blank delimited word Other Navigation yy or :y Yank current line b Move to the beginning of the word y{motion} Yank {motion} text ( Move a sentence back B Move to the beginning of the blank delimited word p Put after the position or line ) Move a sentence forward e Move to the end of the word P Put before the position or line { Move a paragraph back E Move to the end of blank delimited } Move a paragraph forward word Changing text fc Move forward to c 0 Move to the beginning of the line C Change to end of the line Fc Move back to c $ Move to the end of the line cc Change the whole line Clean Up 1G or Move to the first line in file guu Lowercase line :0 :g/^$/d Delete blank lines gUU Uppercase line G or Move to the last line in file :%s/\s\+ Delete trailing white space ~ Toggle upper and lower case :$ $// nG or Move to the nth line in file Searching :s/\s\+/ Delete all extra white space :n /g between words /string Search forward for string % Move to associated (), {}, [] ?string Search backwards for string By adzz Published 15th September, 2016. Sponsored by ApolloPad.com cheatography.com/adzz/ Last updated 16th September, 2016. Everyone has a novel in them. Finish Yours! Page 1 of 1. https://apollopad.com

Use Quizgecko on...
Browser
Browser