Hello there Nullbyte users!
This will be my first article here.
Feel free to give feedback in the comments!
Today I'll be introducing the UNIX text editor VIM.
VIM is a text editor that is completely controlled from the keyboard.
An experienced VIM user is A LOT faster than a sublime user and since time = hacking, we don't want to waste time.
Step 1: Getting VIM
VIM is available for all UNIX based OS'es. In fact big chance you already have it. You can see if you have vim by simply typing 'vim' in the terminal.
If you get an error 'command not found' simply download vim by using:
$ sudo apt-get install vim
or
$ sudo dnf install vim
if that doesnt work you can install it from source, unpack, read the README and follow from there.
Step 2: Opening VIM
Alright, now that's done, type in 'vim' in the terminal.
what you'll see is something like:
Step 3: Using VIM
Now as you may have noticed, you are unable to write text and if you tried, some 'random' commands may have been executed.
The reason for this is that you are not in Insert Mode but in Normal mode.
To enter Insert Mode simply press i on your keyboard.
You can now type what you want.
To exit Insert Mode and go back to Normal Mode press Esc.
To save a file, make sure you are in Normal Mode and type
:save <filename>
To exit the program, make sure you are Normal Mode and type:
:exit
This is what VIM makes great. You have different modes and in each mode the keys have different meaning.
Insert Mode
Insert mode is not very special, it's basicly just Nano. You can type and (god forbid) navigate with arrow keys.
Normal Mode
This mode is what makes VIM, VIM. In this mode you can:
- search
- quickly edit code
- copy and paste
- turn settings on or off
And a whole lot of other stuff which I will explain in my next guide where I will be covering the Normal mode.
Hope you liked it.
> unh0lys0da
Just updated your iPhone to iOS 18? You'll find a ton of hot new features for some of your most-used Apple apps. Dive in and see for yourself:
7 Comments
That's a great introduction to VIM that makes it seem less intimidating for new users. Good job!
TRT
Thanks!
Good job! Great explanation for new users
Nice intro tutorial. I never got around to learning VIM well, but I need to get back to using it to be more comfortable in the command line. I'll use this for my restart, thanks!
Thnx. As I am new here, It helped me a lot.
Nice tutorial just one things where did you find command :save
therein just command :saveas and if you want to save same changes you just simply type :write.In vim there is one more commands to exit program and this is command :quit which is used more often.But once again very nice tutorial for beginners
Nice intro tutorial to start with vim. Since youre already referring to save time you could've thrown in the commands :wq (write & quit), :w (simple write), or :q! (force quit without changes) which are imho simple to remember ;).
Share Your Thoughts