π§βπ» VIM Code Editor
Vim is a βmodalβ text editor based on the vi editor written by Bill Joy in the 1970s for a version of UNIX.
π³ What is modal?
When youβre using most word processors and text editors, the alphanumeric keys (i.e., a through z, 1 through 9) are only used to input those characters unless theyβre modified by a control key. In Vim, the mode that the editor is in determines whether the alphanumeric keys will input those characters or move the cursor through the document.
π The Basics of Moving in Vim
h β moves the cursor one character to the left.
j β moves the cursor down one line.
k β moves the cursor up one line.
l (L) β moves the cursor one character to the right.
0 β moves the cursor to the beginning of the line.
$ β moves the cursor to the end of the line.
w β move forward one word.
b β move backward one word.
G β move to the end of the file.
gg β move to the beginning of the file.
`. β move to the last edit.
π Editing Vim Style
d β starts the delete operation.
dd β One line delete or cut
dw β will delete a word.
d0 β will delete to the beginning of a line.
d$ β will delete to the end of a line.
dgg β will delete to the beginning of the file.
dG β will delete to the end of the file.
u β will undo the last operation.
Ctrl-r β will redo the last undo.
π Searching and Replacing
/text β search for text in the document, going forward.
n β move the cursor to the next instance of the text from the last search. This will wrap to the beginning of the document.
N β move the cursor to the previous instance of the text from the last search.
?text β search for text in the document, going backwards.
π Copying and Pasting
yy β To Copy a line
dd β To cut a line
p/P β Paste a line
π Saving and Quitting
:q β Quite
:q! β Quite and not save
:w β Save
:wq β Save and Quite
:wq! β To save Read only File (If have permission)
:x β Save and Quite {Not Recommended} π³
π§βπ» Contributors
Abrar Mehedi π Follow me on Github
Top comments (0)