DEV Community

What one should know about VIM before starting to use it?

Rafael Paulo on October 09, 2017

I really want to start using VIM, but I would like to know what do you think it is important to know before starting to venture out with it.

Collapse
 
goodidea profile image
Joseph Thomas

I've been using vim-mode-plus in Atom as a way to get familiar with it. If there's something I don't know how to do in vim, I can just go into insert mode (i), then I'm back in the normal text editing mode.

If I catch myself using my mouse to do something, or am doing anything that feels repetitive, I'll stop for a minute to learn how to do it smarter in Vim, then try to remember it and incorporate it into my workflow.

Collapse
 
ameliagapin profile image
Amelia Gapin

I did the same thing for about two weeks before switching to actual vim. It really helped me ease into things with the crutch of Atom still there.

Collapse
 
maestromac profile image
Mac Siri • Edited

I've been using vim for a few months now and it did take me a few weeks before I can start working on it. So the following tips/steps are my suggestions.

  1. Go through a tutorial: Any forms of tutorial is a nice start. My favorite is vimtutor which is already included in vim. Other Worthy mentions are openvim and vim-adventures
  2. Download a vim-mode extension for your current editor/IDE. This will help you slowly ease into vim's workflow. The plus side to this is that you can always turn the extension off if you must get something done.
  3. Once you are fairly efficient, you'll start up vim and quickly learn that the raw naked vim is not fun to use. The great thing about being a vim user is that you get to customize this editor to any way you like via .vimrc. I'd recommend you pick one vim plug manager(I personally love vim-plug) and the following two vim extension as a must-have.
  4. That's kind of it. You'll start to seek out the ideal plug-in that you'll want and learn more about vim as you go. You may even make a big leap and switch to a vim's variant like MacVim or NeoVim.

A few don'ts

  • Don't completely switch to vim without basic knowledge, it can negatively impact your efficiency.
  • Don't just take a dotfile online and use it without understanding what it contains. It will be overwhelming and certain configuration may not suits you.
Collapse
 
kspeakman profile image
Kasey Speakman

Esc, :q!

Escape gets you out of insert mode if you are currently in it. :q! quits without saving. The first thing you need to know about any program (which takes over the screen) is how to exit.

Collapse
 
phrasendroschke profile image
skirnir

You should start with vimtutor. Probably several times.

Then fire up vim and type :help. The first page will teach you to navigate help. Find user_toc.txt and start reading. After that you should be able to decide how to proceed on your own.

BTW, "Practical Vim" by Drew Neil is a great book.

Collapse
 
tandrewnichols profile image
Andrew Nichols

I really think you can get by in vim with almost no previous knowledge about it. I'd say the very very basic things that will make it usable are

i = In normal mode, go to insert mode.
Esc = In insert mode, go to normal mode.

These two alone mean you can use vim almost like a normal editor. If you don't know how to do something the vim way, do it the way you'd do it in any other editor. If you really want to do it exactly like a normal editor, you can do :set mouse=a, but that will probably hamper your vim development because you'll rely on the mouse instead of feeling the pain of using the arrow keys and thinking "there must be a better way." That pain is useful to help you learn vim.

And of course, you need:

:q = quit
:w = save
:wq or :x = save and quit
:q! = force quit without saving

As all the memes suggest, vim newcomers sometimes have a hard time exiting vim...

Collapse
 
psnebc profile image
Patrick Schanen

My Notes

VIM
Vim | vim.org
VIM - GITHUB
Github | github.com/vim/vim
Github Issues | github.com/vim/vim/issues
Github Pulls Requests | github.com/vim/vim/pulls
Github Commits Activity | github.com/vim/vim/graphs/commit-a...
VIM - PLUGINS ON VIM.ORG
Browse all Plugins | vim.org/scripts/script_search_resu...
Recent Script Update | vim.org/scripts/index.php
VIM - PLUGINS RESOURCES
Vim plugins sourced from GitHub | vimawesome.com
Trending Vim script repositories on GitHub today | github.com/trending/vim-script
Collaborative list of awesome vim resources | github.com/matteocrippa/awesome-vim
VIM - COLORS
Solarized Theme | ethanschoonover.com/solarized
Vim Colors | vimcolors.com
VIM - DISTRIBUTIONS
Distribution on Github
By most stars | github.com/search?o=desc&q=vim+dis...
By recently updated | github.com/search?o=desc&q=vim+dis...
VIM - USERS BLOGS
Durcheinandr | durcheinandr.de/tag/vim
Nop Wibben | nop.wibben.de
Freblogg | freblogg.com/search/label/Vim
Daily Vim Tumblr | dailyvim.tumblr.com
Daily Vim Blogspot | dailyvim.blogspot.lu
Yannesposito | yannesposito.com/Scratch/en/blog/L...
Tilvim | tilvim.com
Usevim | usevim.com
VIM - HELP RESOURCES
Wikia | vim.wikia.com/wiki/Vim_Tips_Wiki
Tips and Tricks | cs.swarthmore.edu/help/vim/
Vim Galore | github.com/mhinz/vim-galore
VIM - USERS ON TWITTER
Be Vimmer | twitter.com/be_vimmer_en
Vim Tips | twitter.com/vimtips
VIM - VIMRC FILES
Wilkox | github.com/wilkox/vim/blob/master/...
Konstad | git.konstad.me/chriskonstad/dotfil...
Dougblack | github.com/dougblack/dotfiles/blob...
VIM - DOCUMENTATION ON VIMDOC
Map Keys | vimdoc.sourceforge.net/htmldoc/map...
VIM - ARTICLE
Introduction
Vim Kurzeinführung | www-user.tu-chemnitz.de/~hot/VIM/V...
Cheatsheet
Vim Keyboard Shortcuts Cheatsheet | maketecheasier.com/vim-keyboard-sh...
Cheat Sheets Matching "Vim" | cheatography.com/explore/search/?q...
Cheat Sheet on Duckduckgo | duckduckgo.com/?q=vim+cheat+sheet&... | duck.co/ia/view/vim_cheat_sheet
Vim Quick Reference Guide | alexquinn.org/techref/Vim_Quick_Re...
Vimrc
A good Vimrc | dougblack.io/words/a-good-vimrc.html
Plugins
Google Vim Plugins | opensource.google.com/projects/vim...

Collapse
 
weswedding profile image
Weston Wedding

I feel like a good answer depends a lot on your end goal.

VIM is my go-to command line text editor when I want to make minor updates to files on a server I'm maintaining. In that case, as someone else mentioned, understanding the difference between insert mode and command mode and how to quit is the very first thing you need to do (dev.to/rafaell_paulo/what-one-shou...)!

If you want it to be a replacement for an IDE or a text editor like Atom, though, you might have a long road ahead of you. Just quitting VIM is initially not intuitive; it doesn't get any better the more complex you go, in my experience!

Collapse
 
rbanffy profile image
Ricardo Bánffy

All you need to know is that Emacs is better.

/me ducks

Collapse
 
nektro profile image
Meghan (she/her)

Don't forget to hit Insert and Esc

:x is close and save

Collapse
 
psnebc profile image
Patrick Schanen • Edited

Used Vim github.com/spf13/spf13-vim for a long time. And Vim Mode on phpstorm, kate, firefox ... I switched to Emacs ( 07/2017) and use Evil-Mode.

Collapse
 
seanbreeden profile image
sean

Search and replace is pretty easy in vim.

Hit ESC
Then at the :

%s/SEARCH_HERE/REPLACE_HERE/g