The vi Editor Modes. The vi editor provides three modes of operation: 1. Command mode – The command mode is the default mode for the vi editor. In this mode, you can run commands to delete, change, copy, and move text. You can also position the cursor, search for text strings, and exit the vi editor. Vi Reference Card Modes Vi has two modes: insertion mode, and command mode. The editor begins in command mode, where cursor move-ment and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. ESC returns the editor to command mode (where you can quit, for example by typing:q!). Most commands execute. Graphical cheat sheet This is a single page describing the full vi/vim input model, the function of all keys, and all major features. You can see it as a compressed vi/vim manual. About the vim cheat sheet. This project aims to be one of the most accessible vim guides available. We made sure to support mobile, desktop, and other languages. ️ Please consider sponsoring this project ️!
Click here for the Advanced VI Cheatsheet
Modes
| Vi has two modes insertion mode and command mode. The editor begins in command mode, where the cursor movement and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. [ESC] returns the editor to command mode (where you can quit, for example by typing :q!). Most commands execute as soon as you type them except for 'colon' commands which execute when you press the ruturn key. |
Quitting
| :x | Exit, saving changes |
| :q | Exit as long as there have been no changes |
| ZZ | Exit and save changes if any have been made |
| :q! | Exit and ignore any changes |
Inserting Text
| i | Insert before cursor |
| I | Insert before line |
| a | Append after cursor |
| A | Append after line |
| o | Open a new line after current line |
| O | Open a new line before current line |
| r | Replace one character |
| R | Replace many characters |
Motion
| h | Move left |
| j | Move down |
| k | Move up |
| l | Move right |
| w | Move to next word |
| W | Move to next blank delimited word |
| b | Move to the beginning of the word |
| B | Move to the beginning of blank delimted word |
| e | Move to the end of the word |
| E | Move to the end of Blank delimited word |
| ( | Move a sentence back |
| ) | Move a sentence forward |
| { | Move a paragraph back |
| } | Move a paragraph forward |
| 0 | Move to the begining of the line |
| $ | Move to the end of the line |
| 1G | Move to the first line of the file |
| G | Move to the last line of the file |
| nG | Move to nth line of the file |
| :n | Move to nth line of the file |
| fc | Move forward to c |
| Fc | Move back to c |
| H | Move to top of screen |
| M | Move to middle of screen |
| L | Move to botton of screen |
| % | Move to associated ( ), { }, [ ] |
Deleting Text
| Almost all deletion commands are performed by typing d followed by a motion. For example, dw deletes a word. A few other deletes are: |
| x | Delete character to the right of cursor |
| X | Delete character to the left of cursor |
| D | Delete to the end of the line |
| dd | Delete current line |
| :d | Delete current line |
Yanking Text
| Like deletion, almost all yank commands are performed by typing y followed by a motion. For example, y$ yanks to the end of the line. Two other yank commands are: |
| yy | Yank the current line |
| :y | Yank the current line |
Changing text
| The change command is a deletion command that leaves the editor in insert mode. It is performed by typing c followed by a motion. For wxample cw changes a word. A few other change commands are: |
| C | Change to the end of the line |
| cc | Change the whole line |
Putting text
Linux Vi Editor Cheat Sheet
| p | Put after the position or after the line |
| P | Put before the poition or before the line |
Buffers
| Named buffers may be specified before any deletion, change, yank or put command. The general prefix has the form 'c where c is any lowercase character. for example, 'adw deletes a word into buffer a. It may thereafter be put back into text with an appropriate 'ap. |
Markers
| Named markers may be set on any line in a file. Any lower case letter may be a marker name. Markers may also be used as limits for ranges. |
| mc | Set marker c on this line |
| `c | Go to beginning of marker c line. |
| 'c | Go to first non-blank character of marker c line. |
Search for strings
| /string | Search forward for string |
| ?string | Search back for string |
| n | Search for next instance of string |
| N | Search for previous instance of string |
Replace
| The search and replace function is accomplished with the :s command. It is commonly used in combination with ranges or the :g command (below). |
| :s/pattern/string/flags | Replace pattern with string according to flags. |
| g | Flag - Replace all occurences of pattern |
| c | Flag - Confirm replaces. |
| & | Repeat last :s command |
Regular Expressions
| . (dot) | Any single character except newline |
| * | zero or more occurances of any character |
| [..] | Any single character specified in the set |
| [^..] | Any single character not specified in the set |
| ^ | Anchor - beginning of the line |
| $ | Anchor - end of line |
| < | Anchor - begining of word |
| > | Anchor - end of word |
| (..) | Grouping - usually used to group conditions |
| n | Contents of nth grouping |
| [A-Z] | The SET from Capital A to Capital Z |
| [a-z] | The SET from lowercase a to lowercase z |
| [0-9] | The SET from 0 to 9 (All numerals) |
| [./=+] | The SET containing . (dot), / (slash), =, and + |
| [-A-F] | The SET from Capital A to Capital F and the dash (dashes must be specified first) |
| [0-9 A-Z] | The SET containing all capital letters and digits and a space |
| [A-Z][a-zA-Z] | In the first position, the SET from Capital A to Capital Z In the second character position, the SET containing all letters |
| /Hello/ | Matches if the line contains the value Hello |
| /^TEST$/ | Matches if the line contains TEST by itself |
| /^[a-zA-Z]/ | Matches if the line starts with any letter |
| /^[a-z].*/ | Matches if the first character of the line is a-z and there is at least one more of any character following it |
| /2134$/ | Matches if line ends with 2134 |
| /(21|35)/ | Matches is the line contains 21 or 35 Note the use of ( ) with the pipe symbol to specify the 'or' condition |
| /[0-9]*/ | Matches if there are zero or more numbers in the line |
| /^[^#]/ | Matches if the first character is not a # in the line |
| Notes: 1. Regular expressions are case sensitive 2. Regular expressions are to be used where pattern is specified | |
Counts
| Nearly every command may be preceded by a number that specifies how many times it is to be performed. For example, 5dw will delete 5 words and 3fe will move the cursor forward to the 3rd occurence of the letter e. Even insertions may be repeated conveniently with thismethod, say to insert the same line 100 times. |
Ranges

| Ranges may precede most 'colon' commands and cause them to be executed on a line or lines. For example :3,7d would delete lines 3-7. Ranges are commonly combined with the :s command to perform a replacement on several lines, as with :.,$s/pattern/string/g to make a replacement from the current line to the end of the file. |
| :n,m | Range - Lines n-m |
| :. | Range - Current line |
| :$ | Range - Last line |
| :'c | Range - Marker c |
| :% | Range - All lines in file |
| :g/pattern/ | Range - All lines that contain pattern |
Files
| :w file | Write to file |
| :r file | Read file in after line |
| :n | Go to next file |
| :p | Go to previos file |
| :e file | Edit file |
| !!program | Replace line with output from program |
Other
| ~ | Toggle upp and lower case |
| J | Join lines |
| . | Repeat last text-changing command |
| u | Undo last change |
| U | Undo all changes to line |
Return to the top
The vi editor is a command-line, interactive editor that you can use to create and modify text files. The vi editor is also the only text editor that you can use to edit certain system files without changing the permissions of the files. The Vim editor is an enhanced version of the vi editor.
Accessing the vi Editor
To create, edit, and view files in the vi editor, use the vi command. The vi command includes the following three syntaxes:
If the system crashes while you are editing a file, you can use the -r option to recover the file. How to download in netflix on mac.
The file opens so that you can edit it. You can then save the file and exit the vi editor, by using the following command:

The file opens in read-only mode to prevent accidental overwriting of the contents of the file.
The vi Editor Modes
The vi editor provides three modes of operation:
1. Command mode – The command mode is the default mode for the vi editor. In this mode, you can run commands to delete, change, copy, and move text. You can also position the cursor, search for text strings, and exit the vi editor.
2. Input mode – You can insert text into a file in the input mode. The vi editor interprets everything you type in the input mode as text. To invoke input mode, press one of the following lowercase keys:
- i – Inserts text before the cursor
- o – Opens a new blank line below the cursor
- a – Appends text after the cursor
You can also invoke the input mode to insert text into a file by pressing one of the following uppercase keys:
- I – Inserts text at the beginning of the line
- O – Opens a new blank line above the cursor
- A – Appends text at the end of the line
3. Last line mode – You can use advanced editing commands in the last line mode. To access the last line mode, enter a colon (:) while in the command mode. Entering the colon (:) character places the cursor at the bottom line of the screen.
Switching Between Modes
– The default mode for the vi editor is the command mode.
– To switch to the input mode, press i, o, or a.
– To return to the command mode, press the Escape key.
– In the command mode, you can save the file and quit the vi editor, and return to the shell prompt.
Viewing Files in the Read-Only Mode
The view command enables you to view files in the read- only mode.
The view command invokes the vi editor in the read-only option, which means you cannot save changes to the file. For example, to view the data.txt file in the read-only mode, enter the following command:
The data.txt file appears. Enter the :q command to exit the file, exit the vi editor, and return to the shell prompt.
Moving the Cursor Within the vi Editor
The table shows the key sequences that move the cursor.
| Key Sequence | Cursor Movement |
|---|---|
| h, left arrow, or Backspace | Left one character |
| j or down arrow | Down one line |
| k or up arrow | Up one line |
| l, right arrow, or space bar | Right (forward) one character |
| w | Forward one word |
| b | Back one word |
| e | To the end of the current word |
| $ | To the end of the line |
| 0 (zero) | To the beginning of the line |
| ^ | To the first non-white space character on the line |
| Return | Down to the beginning of the next line |
| G | Goes to the last line of the file |
| 1G | Goes to the first line of the file |
| :n | Goes to Line n |
| nG | Goes to Line n |
| Control + F | Pages forward one screen |
| Control + D | Scrolls down one-half screen |
| Control + B | Pages back one screen |
| Control + U | Scrolls up one-half screen |
| Control + L | Refreshes the screen |
| Control + G | Displays current buffer information |

Inserting and Appending Text
The table describes the commands to insert and append text to a new or existing file by using the vi editor.
| Command | Function |
|---|---|
| a | Appends text after the cursor |
| A | Appends text at the end of the line |
| i | Inserts text before the cursor |
| I | Inserts text at the beginning of the line |
| o | Opens a new line below the cursor |
| O | Opens a new line above the cursor |
| :r filename | Inserts text from another file into the current file |
Text-Deletion Commands
The table shows commands that delete text in the vi editor.
| Command | Function |
|---|---|
| R | Overwrites or replaces characters on the line at and to the right of the cursor. To terminate this operation, press Escape. |
| C | Changes or overwrites characters from the cursor to the end of the line |
| s | Substitutes a string for a character at the cursor |
| x | Deletes a character at the cursor |
| dw | Deletes a word or part of the word to the right of the cursor |
| dd | Deletes the line containing the cursor |
| D | Deletes the line from the cursor to the right end of the line |
| :n,nd | Deletes lines n -n (For example, :5,10d deletes lines 5-10.) |
You can use numerous commands to edit files by using the vi editor. The following sections describe basic operations for deleting, changing, replacing, copying, and pasting. Remember that the vi editor is case-sensitive.
DivX Converter Converter is designed for quick and easy conversion of the most popular video formats into high-quality DivX (.divx) and DivX Plus (.mkv) video for your PC and DivX Certified® devices, and it lets you tweak encoding settings, combine videos, and add multiple subtitles and audio tracks. The Free DivX Converter is a universal tool that converts this file type to several other popular formats. Some of these include AVI, MPEG, MP4, MOV, FLV, WMV, etc. Once converted, these files can be played on any media players and portable devices. Import videos from cloud storage to convert in DivX Converter. Easily upload converted videos directly to cloud storage to save space. Download videos from Dropbox or Google Drive and cast them to a DLNA or Chromecast device with DivX Media Server. DivX Software includes a free 15-day trial of Cloud Connect. DivX Player & DivX Converter DivX Player is a proprietary media player designed by DivX, a company.
Firstly, select a divx file you want to convert or drag and drop it. Secondly, select a format you want to convert your file to. Then click convert and wait until your file is converted.
Vi Commands Cheat Sheet Pdf
Edit Commands

The table describes the commands to change text, undo a change, and repeat an edit function in the vi editor.
| Command | Function |
|---|---|
| cw | Changes or overwrites characters at the cursor location to the end of that word |
| r | Replaces the character at the cursor with one other character |
| J | Joins the current line and the line below |
| xp | Transposes the character at the cursor and the character to the right of the cursor |
| ~ | Changes letter casing to uppercase or lowercase, at the cursor |
| u | Undoes the previous command |
| U | Undoes all changes to the current line |
| . | Repeats the previous command |
Search and Replace Commands
The table shows the commands that search for and replace text in the vi editor.
| Command | Function |
|---|---|
| /string | Searches forward for the string |
| ?string | Searches backward for the string |
| n | Searches for the next occurrence of the string. Use this command after searching for a string. |
| N | Searches for the previous occurrence of the string. Use this command after searching for a string. |
| :%s/old/new/g | Searches for the old string and replaces it with the new string globally |
Copy and Paste Commands
Best Vi Editor Cheat Sheet

The table shows the commands that cut, copy, and paste text in the vi editor.
| Command | Function |
|---|---|
| yy | Yanks a copy of a line |
| p | Puts yanked or deleted text under the line containing the cursor |
| P | Puts yanked or deleted text before the line containing the cursor |
| :n,n co n | Copies lines n -n and puts them after line n (For example, :1,3 co 5 copies lines 1-3 and puts them after line 5.) |
| :n,n m n | Moves lines n -n to line n. For example, :4,6 m 8 moves lines 4-6 to line 8, line 6 becomes line 8, line 5 becomes line 7, and line 4 becomes line 6. |
Save and Quit Commands
The table describes the commands that save the text file, quit the vi editor, and return to the shell prompt.
| Command | Function |
|---|---|
| :w | Saves the file with changes by writing to the disk |
| :w new_filename | Writes the contents of the buffer to new_filename |
| :wq | Saves the file with changes and quits the vi editor |
| :x | Saves the file with changes and quits the vi editor |
| ZZ | Saves the file with changes and quits the vi editor |
| :q! | Quits without saving changes |
| ZQ | Quits without saving changes |
Session Customization
You can customize a vi session by setting variables for the session. When you set a variable, you enable a feature that is not activated by default. You can use the set command to enable and disable variables. The set command variables include displaying line numbers and invisible characters, such as the Tab and the end-of-line characters.
To create an automatic customization for all your vi sessions, perform the following steps:
- Create a file named .exrc in your home directory.
- Enter any of the set variables into the .exrc file.
- Enter each set variable without the preceding colon.
- Enter each command on one line.
The vi editor reads the .exrc file located in your home directory each time you open a vi session, regardless of your current working directory.
Session Customization Commands
The table describes some of the variables of the set command.
| Command | Function |
|---|---|
| :set nu | Shows line numbers |
| :set nonu | Hides line numbers |
| :set ic | Instructs searches to ignore case |
| :set noic | Instructs searches to be case-sensitive |
| :set noic | Displays invisible characters, such as ^I for a Tab and $ for end-of-line characters |
| :set nolist | Turns off the display of invisible characters |
| :set showmode | Displays the current mode of operation |
| :set noshowmode | Turns off the mode of operation display |
| :set | Displays all the vi variables that are set |
| :set all | Displays all vi variables and their current values |
