This page is designed to guide you through the basics of using vim. By basics, I mean it. This is certainly not a comprehensive guide or tutorial for vim, but I do hope that, after reading this page, you'll understand enough to get around and be interseted enough to explore on your own.
What this page will cover:
What is vim?
Vim is a (Unix)text editor. It comes with Linux, BSD, and macOS.
Simple Navigation & Features
How to move w/ keyboard keys
The basics of movement in Vim are Left/Right and Up/Down. Below, you can see the key to press for each, along with the arrow for their respective directions.
^ k < h l > j ⌄
Basic commands
Opening/Closing files
To open a file with Vim, open the terminal navigate to the file location, and type: vim filename
.
Example:(file name trial.html)
USER location % vim trial.html return (or enter). *file opened
To close a file in Vim, press esc + shift + ; (shift + ; = :). This should open a sort of prompt mode(if you ever enter this mode by accident, just backspace). From here, there you have a few options
wq
into the prompt window.q!
into the prompt space.q
into the prompt, you will recieve an error message like E37: No write since last change (add ! to override).
Example:
esc + shift + ; *prompt open :[cursor] wq or q! enter *file closed--back in terminal
vimrc & vimtutor
Creating a vimrc file can make the user experience with vim a lot nicer. Vimrc files can change environmental aspects f rom line numbers and sytnax highlighting to the background color in vim. Some people like to modify their vim environment a lot, but, personally, I keep the modifications pretty basic--everyone's different.
If you found this page interesting and want to learn more about vim, I highly reccomend vimtutor. It will take you through a much more in-depth tutorial about vim. To access vimtutor, simply open the terminal and type vimtutor
. There might be an intermediate screen that pops up. If this happens just press enter and you'll be good to go.
Thank you for reading!