1/35
Flashcards covering Vim basics and common editor commands from the lecture notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
vim
A modal text editor used in the terminal to create and modify text files.
mkdir
Create a new directory (example: mkdir /FGCU).
cd
Change the current working directory (example: cd /FGCU).
Renewed save and exit command: :x
Write the current buffer to the file and exit Vim.
:w
Save (write) the current buffer to the file; stay in Vim.
:q!
Quit Vim and discard any unsaved changes.
:q
Quit Vim if there are no unsaved changes; otherwise Vim prompts.
:x!
Force write and exit Vim (overwrite, then quit).
Save as (new file name) with :w
Save the current buffer to a new file name without exiting (e.g., :w xyz saves as xyz).
:r filename
Append the contents of filename into the current file at the cursor position (example: :r /etc/passwd).
o
Insert a new line below the current line and enter insert mode.
O
Insert a new line above the current line and enter insert mode.
x
Delete the character under the cursor.
nx
Delete n characters starting from the cursor.
X
Delete the character before the cursor (backspace).
nX
Delete n characters before the cursor (backward deletion).
yy
Copy the current line into the unnamed register.
nyy
Copy n lines starting from the current line.
p
Paste the previously yanked or deleted text after the cursor.
np
Paste n lines after the current line.
u
Undo the last change.
nu
Undo the last n changes.
Ctrl+R
Redo the most recently undone change.
n Ctrl+R
Redo the next n changes (repeat redo commands).
dd
Delete the current line.
ndd
Delete n lines starting from the current line.
:n
Go to the nth line in the file.
gg or :1
Go to the first line (top) of the file.
G or shift+g or :$
Go to the last line (bottom) of the file.
D (shift+d)
Delete from the cursor position to the end of the line.
d0
Delete from the cursor position to the start of the line.
:1, $ s/A/B/g
Substitute A with B across the entire file (from line 1 to end).
/FGCU
Search forward for the string FGCU.
n
Repeat the last search in the same direction (downward).
N
Repeat the last search in the opposite direction (upward).
Ctrl+G
Show cursor position and status information.