Vim for dummies, part I
A few days ago, @CodeLongAndPros received an anonymous tip, through his penguin minions, to write a tutorial about Vim. He will also stop talking about himself in the third person.
So, here goes!
Vim is a modal editor.
If you type dd in VSCode,
But in Vim, you'll delete a line.
This is because Vim has 5 modes. (You'll only use three 90% of the time). They are:
You'll have two options:
- Use Linux and install Vim
- Use my Repl
- Use GVim
If you go to my repl, keep in mind a lot of stuff, fun stuff, won't work.
If you use Linux you can do:
sudo pacman/apt/emerge/ynm/dnf install/-Syu/-a vim
If you use Micro$oft's trash, you can use GVim
After you've installed Vim, summon it with
$ vim ~/.vimrc
For NT, look at this.
From hereon out, I won't support NT. You're on your own.
When you invoke Vim, you'll see this:
Your's may or may not look like mine, but it'll be generally the same.
How to read my commands
If you see some nonsense like
ggVGd, enter it as you see it
However, if you see someting in brackets, without a
\ before it, do what it says:
<ESC>: Press esc
<CR>: Press enter
<F5>: Press f5
How to type
cat in your Vim window.
Nothing should happen.
You have the text
Congrats! You just saved a file!
This one's a doozy.
There are a couple ways:
You can do
:wq to exit + save,
:q! to exit and not save
You can do
:x in place of
You can also do
ZZ to s + q and
ZQ to q.
Part II will come out soon!
The first time I opened vim I spent like literally 10 min just writing garbage in insert mode bc I had no idea that normal mode even existed XD I was just
:wq :q :x :fgjotfjkwosoxksbuwpqpqpqdkdbshisjssjheeeeellllppppmeeeeee
@DynamicSquid nope. Vim still is a very powerful thing. Vim is like the C++ of text editors. It could be viewed as old and “outdated” I guess, but only in the same way one would view the cli as old or outdated. It’s still being updated and everything and it’s loterally everywhere.
Hm I’m sorry if I’m being rude :/
@DynamicSquid yes, it does. I don’t know all of the advantages bc I have a very rough knowledge of vim, but yeah it definitely does. Take @CodeLongAndPros editor pics, they show a completely customized editor. That’s a big thing ppl like from editors like atom. Another: configuring commands with the map command. Another: autogroups. Another: um.. idk there’s more. Lol. Point is there is t much that vim doesn’t already have that other editors have, in addition to stuff that nothing but maybe the vi editor has. In addition it has its own lang, so you can see where that goes. Infinite innovation and customization.
@CodeLongAndPros ... I’m sorry I followed the Xkcd link and went down a rabbit hole 😬 what exactly do you mean by append to thread, but don’t reply to messages? Isn’t it the same thing? Or wait like I’m just replying other ppl’s stuff and not my own? Am I even close to what your talking about? I’m lost :(
@Highwayman So if I make a comment on a post, it looks like this:
Post | |-> Comment
If you reply to that comment:
Post | |- Comment | |- Sub_comment
But if you reply to
Post | |- Comment | |- Sub_comment | |- Actually replying to sub_comment. (Should be):" |- Actually replying to sub-comment.