DEV Community

"My First Two Weeks Using VIM"

Vince Campanale on August 01, 2017

I have been putting this off for a while. I have always admired people that use Vim. I view them as sort of "super devs". If they use Dvorak, I h...
Collapse
 
alancampora profile image
Alan Campora

Edit and move are modes, not actions. Actions are something different. For example, if you want to replace a word, put your cursor on it and press c(change) i(inner) w(word). That's a great level up :D

Collapse
 
vincecampanale profile image
Vince Campanale

Thanks Alan! I included this in the update for the end of week 1 because it was very helpful

Collapse
 
alancampora profile image
Alan Campora

Cool man! It's great to see the process of learning vim in other person, because more or less I went through the same things =)

Collapse
 
legolord208 profile image
jD91mZM2

That's it, I'm going to say it. Why does everybody like the hjkl keys? For me it makes typing less usual than normal, puts me futher away from my enter key, makes my hands nearly touch which is very uncomfortable. Plus it also makes me unable to move in insert mode, and especially in command mode.

Collapse
 
alancampora profile image
Alan Campora

Enter key is almost next to the l. Once you get used to hjkl you'll realize that your hands won't never change their position.

Collapse
 
legolord208 profile image
jD91mZM2

What does hjkl offer over the arrow let's though?

Collapse
 
_ni3t profile image
Nick Bell

The key to VIM is thinking in "actions" instead of "movements" -- example the key combo "diw" in normal mode typed in sequence translates to "Delete In Word" -- yiw "Yank (copy) In Word" -- "50j" does 50 "j"s (jump 50 lines down) etc

Collapse
 
etcwilde profile image
Evan Wilde

I've used Vim for about 3 years now. The next step, plugins. A bare vim is just usable, but the plugins make it a home. I use the Vundle package manager, which plugs into vim pretty nicely, but there are a few others too. I remember trying to learn vim though, the hardest part for me was definitely learning the hjkl. It took about a month of being completely useless before I was able to move around reliably and start getting work done. I've really only used vim on the terminal. I love the terminal, it is what changes the OS into your full IDE, which is not something that vim is intended to be. With regard to escape key, definitely recommend remapping escape and caps lock (unless you use Fortran or something). Escape is way more useful, and caps lock is a waste of prime real estate.

I would also recommend trying Emacs as well while you are trying out different editors. The plugins for emacs tend to be slightly more polished, and at least for my purposes, Org-mode makes it almost vital to normal functioning. Vim was not intended to be an end-all program for doing everything in development, so while the plugins can make it appear to be a full IDE, it will get slow. I mean, really slow. This seems to be especially true in vim + LaTeX + tmux, where with all the syntax highlighting and fancy plugins, it would take roughly 10 seconds to move the cursor one character. Emacs, on the other hand, is very smooth. Under normal circumstances, vim is great. Good luck with your adventures.

Collapse
 
jeanbernard profile image
Jean Bernard

Keep at it! Learning VIM is well worth it. You'll be super fast in no time. I forced myself to learn VIM and now I don't even use the mouse.

Pro-tip: I use "jj" as a shortcut to the ESC key. That way when you want to switch back to normal mode you don't have to go all the way to the ESC key.

Collapse
 
vincecampanale profile image
Vince Campanale

Love that tip -- thanks Jean! I'll have to add it to the tip log tomorrow.

Collapse
 
strredwolf profile image
STrRedWolf

There's one thing to remember about using vi (and by extension, vim):

It's designed for brain-damaged terminals.

Seriously. There's three types of terminals:

  • Normal, where you can use Emacs or even something lighter like joe or nano. See: DEC's VT-52, VT-100, xterm, linux console, ANSI in Windows, etc...
  • Brain-damaged, where there's always some quirk and it's just barely capable if you work around it. See: Wyse 50.
  • Brain-dead, where you might as well be typing into a typewriter. See: "dumb" terminal emulation, any line printer, etc...

I classify the Wyse 50 as brain damaged, because you do not have a non-destructive way of moving left or right. You got backspace and space. Nothing else to move left or right on a line. That's something you need for Emacs, joe, nano... most every text editor out there for the console...

...except vi, which has separate command/text entry modes for this type of damage, and ed, which is a straight line editor (which is a different type of hell shared by MS-DOS's EDLIN).

The funny thing about it, vi is always available on every Unix distro...

Collapse
 
niorad profile image
Antonio Radovcic

A big breakthrough for me with Vim was to understand the difference between Buffers and Tabs. Tabs are just layouts. Buffers are the actual representation of a file in Vim. I had then set my tab-bar to display buffers and barely used real tabs anymore.
This article helped me with this: joshldavis.com/2014/04/05/vim-tab-...

Collapse
 
eljayadobe profile image
Eljay-Adobe • Edited

I use Vim all the time, for about the last 20 years. I've set my OS on all my computers to treat one of the keys that I otherwise never ever ever use as the ESC key.

I map Caps Lock to ESC.

Q. Why are hjkl used as arrows?

A. Because vi was developed on an ADM-3A, and that's where the arrow keys are.

Q. What is a good keyboard for Vim enthusiasts?

A. That's very preference driven. I love the IBM model M keyboard (still being made by Unicomp), and the Razer Blackwidow Tournament Edition Chroma. Some Vim people I know like the Happy Hacking keyboard. Your mileage may vary.

Q. Is there a good Vim cheat sheet?

A. There are quite a few! I like Graphical cheat sheet which also has a tutorial, and Beautiful.

Collapse
 
blakebarnes00 profile image
Blake Barnes

Vim i ssomething that I really love using, but I only use it when I am on Linux because you can't simply replace a whole IDE for things like C++, although people still attempt it. Good luck though! Vim is a wonderful program and very fun to use.

Collapse
 
jrock2004 profile image
John Costanzo

Yes you can. Take a look at YouCompleteMe and SuperTab

Collapse
 
damcosset profile image
Damien Cosset

I used VIM for a few weeks. It is a challenging editor to learn, but by using it, I can understand why some developers love it. I don't use it anymore but had fun with it. Good luck!

Collapse
 
contactsunny profile image
Sunny Srinidhi

I use it only when I SSH into a server instance and change stuff there. I think I'll try the CLI tutorial you mentioned. Seems to be fun.

Collapse
 
ben profile image
Ben Halpern

Hell yeah. As someone casually considering VIM I'm looking forward to keeping up with your updates as you progress.

Collapse
 
peterfication profile image
Peter Gundel

I've made the same journey some months ago, go for it :) Here is my post from back then: dev.to/peterfication/finally-switc...

Collapse
 
cdw9 profile image
Chrissy Wainwright

vim-adventures.com is also a fun way to learn