vimnox <===> editor Vim (bez závislosti na X)

Normal mode

Normal mode allows you to give commands to the editor. Functions such as the following can be found here:

:w to write/save.

:q to quit.

:w <filename.txt> to name a new file.

:q! to quit without saving the changes to the file

Press the Esc key to start the Normal mode and enter :(desired command) [Enter] to perform your intended task. For example, if I was working in a new file and wanted to name it 'file.txt', I would use the following: 

:w file.txt [ENTER]


Insert mode

If you have made it this far, you probably know what the Insert mode does. However, for those who don't, if you press the I key (lowercase i) once you will see the "INSERT" prompt at the bottom of the screen, indicating that you can now edit or add text.

To exit this mode and return to Normal mode, press the Esc key once. 


Tipy

dd removes all text from the current line (deleting the full line) and saves the removed text to the clipboard. 

p pastes (puts) anything from the Vim clipboard to the current cursor, and pairs nicely with the full line delete shortcut above. 

r replaces a character and is great for a quick correction.

Using r is a bit more complicated than the others:

  1. Press Esc to enter Normal mode.
  2. Move the cursor onto the character you wish to correct.
  3. Type r followed by the character that you wish to use. 

For example, "Goodbee" can be edited to "Goodbye" by highlighting the first "e" and then entering ry

Shortcut Keys Function
Main  
Esc Gets out of the current mode into the “command mode”. All keys are bound of commands.
I “Insert mode” for inserting text. Keys behave as expected.
: “Last-line mode” where Vim expects you to enter a command such as to save the document.
:term Open a terminal window.
Navigation Keys  
H Move the cursor one character to the left.
J or Ctrl + J Move the cursor down one line.
K or Ctrl + P Move the cursor up one line.
l Move the cursor one character to the right.
0 Move the cursor to the beginning of the line.
$ Move the cursor to the end of the line.
^ Move the cursor to the first non-empty character of the line.
w Move forward one word (next alphanumeric word).
W Move forward one word (delimited by a white space).
5W Move forward five words.
b Move backward one word (previous alphanumeric word).
B Move backward one word (delimited by a white space).
5B Move backward five words.
G Move to the end of the file.
GG Move to the beginning of the file.
Navigate Around The Document  
( Jump to the previous sentence.
) Jump to the next sentence.
{ Jumps to the previous paragraph.
} Jumps to the next paragraph.
[[ Jumps to the previous section.
]] Jumps to the next section.
[] Jump to the end of the previous section.
][ Jump to the end of the next section.
Insert Text  
a
(lowercase A)
Insert text after the cursor.
A
(uppercase A)
Insert text at the end of the line.
I Insert text before the cursor.
o
(lowercase O)
Begin a new line below the cursor.
O
(uppercase A)
Begin a new line above the cursor.
Special Inserts  
:R [filename] Insert the file [filename] below the cursor.
:R ![command] Execute [command] and insert its output below the cursor.
Delete Text  
X Delete character at cursor.
DW Delete a word.
D0 Delete to the beginning of a line.
D$ Delete to the end of a line.
D) Delete to the end of sentence.
DGG Delete to the beginning of the file.
DG Delete to the end of the file.
DD Delete line.
3DD Delete three lines.
Simple Replace Text  
R{text} Replace the character under the cursor with {text}.
R Replace characters instead of inserting them.
Copy/Paste Text  
YY Copy current line into storage buffer.
[“x]yy Copy the current lines into register x.
p
(lowercase P)
Paste storage buffer after current line.
P
(uppercase A)
Paste storage buffer before current line.
[“X]P Paste from register x after current line.
[“X]P Paste from register x before current line.
Text Modification  
CC Change the text of the current line.
CE Change the currently selected word at the current cursor point.
C$ Change the text from the cursor position until the end of the line.
C0 Change the text from the cursor position until the start of the line.
G~ Switch the case of the currently selected text as well as the line adjacent to it to its opposite.
Gu Change the case of the currently selected text as well as the line adjacent to it to lowercase.
GU Change the case of the currently selected text as well as the line adjacent to it to uppercase.
Context-Specific Modification  
CIW Change the currently selected word regardless of cursor position.
CIP Change the currently selected paragraph or code block regardless of cursor position.
CI< Change the content of a code block enclosed in angle brackets (<>).
CI{ Change the content of a code block enclosed in curly brackets ({}).
DIW Delete the currently selected word regardless of cursor position.
DIP Delete the currently selected paragraph or code block regardless of cursor position.
DAW Delete the currently selected word as well as the spaces before and after it.
DI< Delete the content of a code block enclosed in angle brackets (<>).
DI{ Delete the content of a code block enclosed in curly brackets ({}).
YIW Copy the currently selected word regardless of cursor position.
YIP Copy the currently selected paragraph or code block regardless of cursor position.
YAW Copy the currently selected word as well as the spaces before and after it.
YI< Copy the content of a code block enclosed in angle brackets (<>).
YI{ Copy the content of a code block enclosed in curly brackets ({}).
Undo/Redo Operation  
U Undo the last operation.
Ctrl + R Redo the last undo.
:earlier 1m Go back 1 minute in the history of the document.
:later 1m Go forward 1 minute in the history of the document.
Search and Replace Keys  
/search_text Search document for search_text going forward.
?search_text Search document for search_text going backward.
n
(lowercase n)
Move to the next instance of the result from the search.
N
(uppercase A)
Move to the previous instance of the result.
:%s/original/replacement Search for the first occurrence of the string “original” and replace it with “replacement”.
:%s/original/replacement/g Search and replace all occurrences of the string “original” with “replacement”.
:%s/original/replacement/gc Search for all occurrences of the string “original” but ask for confirmation before replacing them with “replacement”.
F Search for the next occurrence of a character or go to the previous occurrence.
Bookmarks  
M {a-z A-Z} Set bookmark {a-z A-Z} at the current cursor position.
:marks List all bookmarks.
`{a-z A-Z} Jumps to the bookmark {a-z A-Z}.
Select Text  
v
(lowercase V)
Enter visual mode per character.
V
(uppercase A)
Enter visual mode per line.
Esc Exit visual mode.
Modify Selected Text  
~ Switch case.
D Delete a word.
C Change a word.
Y Yank (copy) a word.
> Shift right.
< Shift left.
! Filter through an external command.
Text Indentation  
>> Shift the currently selected line one Tab length to the right.
<< Shift the currently selected line one Tab length to the left.
gg=G Shift the current buffer by one Tab length.
>% Shift the currently selected code block to the right.
<% Shift the currently selected code block to the left.
>IB Shift the contents of the currently selected block to the right.
<IB Shift the contents of the currently selected block to the left.
>AT Shift the contents of a block that is enclosed in angle brackets (<>) to the right.
<AT Shift the contents of a block that is enclosed in angle brackets (<>) to the left.
Macros  
Q[character] Record a Vim macro that is accessible under the [character] key.
Q Stop a Vim macro recording.
@[character] Execute a recorded Vim macro that was saved under the [character] key.
@@ Execute the last Vim macro that was run.
Search and Execute  
:G/[pattern]/[vim command] Run the [vim command] in the current line for every instance of the [pattern].
:G!/[pattern]/[vim command] Run the [vim command] in the current line for every instance that is not the [pattern].
:%G/[pattern]/[vim command] Run the [vim command] on the entire document for every instance of the [pattern].
:%G!/[pattern]/[vim command] Run the [vim command] on the entire document for every instance that is not the [pattern].
Tab Manipulation  
:TABE [file path] Open the [file path] in a separate tab in the current buffer.
:TABN Switch to the next active tab in the buffer.
:TABP Switch to the previous active tab in the buffer.
:TABC Close the currently active tab in the buffer.
:TABO Close all inactive tabs in the buffer.
Buffer Manipulation  
:SP [file path] Open the [file path] as a horizontally split buffer.
:VSP [file path] Open the [file path] as a vertically split buffer.
:LS Show a list of all the buffers currently open in Vim.
:BN Display the contents of the next open buffer in the buffer list.
:BP Display the contents of the previous open buffer in the buffer list.
Ctrl + W, then S Split the current window horizontally, displaying the currently active buffer in both windows.
Ctrl + W, then V Split the current window vertically, displaying the currently active buffer in both windows.
Ctrl + W, then W Switch focus between the split buffers.
Ctrl + W, then X Swap the position of the currently focused buffer with an inactive one.
Ctrl + W, then Q Delete the currently selected buffer.
Save and Quit  
:Q Quits Vim but fails when file has been changed.
:W Save the file.
:W new_name Save the file with the new_name filename.
:WQ Save the file and quit Vim.
:Q! Quit Vim without saving the changes to the file.
ZZ Write file, if modified, and quit Vim.
ZQ Same as :q! Quits Vim without writing changes.
:sav file
:saveas file
Save file as.
:clo
:close
Close the current pane.