DEV Community

Sean Francis N. Ballais
Sean Francis N. Ballais

Posted on

I'm considering to use vim or neovim as my primary text editor. Any tips?

I've been using VS Code as my primary text editor. Before, I have been using JetBrains's IDEs, Atom, and Sublime Text. I moved from IDEs to VS Code because a text editor is lighter than any IDE. I initially came from Atom. However, upon discovering and giving VS Code a shot, I was immediately hooked.

I've noticed that I'm using the terminal a lot these days. I wondered if I could use a terminal-based text editor instead. I think it makes perfect sense since I'm also using the terminal a lot. The text editor I have decided upon using is Vim. I also found out about Neovim minutes before I wrote this #discuss item. I think I'll use that instead of just vim.

So, any tips, things I should know, and/or fair warnings in using vim/neovim? What are your experiences in using any of the two?

Thanks! :)

Top comments (8)

Collapse
 
thermatix profile image
Martin Becker • Edited

First of all, if you haven't already, take a look at open vim which is a good way to learn the basics.

Second of all, I jumped cold-turkey, so I can't say the same for you but you will have a noticeable drop in productivity to begin with but will slowly get better and maybe, probably, surpass previous levels of productivity.

Thirdly, don't try to learn to much, find something useful (maybe start with some of the motions as they're like the bread and butter of vim) and practice with that till it becomes second nature then try something else, bit by bit. I found doing that the easiest way to learn vim and I'm still finding new things to learn about vim.

Fourth, have look at plugins and configuring vim, a good way to start is to look at someone's vimrc config but be prepared to drop down a rabbit hole ;).

Vim is hard work but I honestly felt it was worth the trouble to learn as I've not looked back at using sublime or IDE's. I would honestly recommend using NeoVim, simply because I had performance issues that went away with switching to it and they're basically identical but you don't have to do that if you don't want to.

Collapse
 
mjb2kmn profile image
MN Mark • Edited

I agree with all of that and would like to add: patience. It's implicit in the Second, but I wanted to make it explicit. I tried and gave up on vim twice before sticking with it and starting to understand it.

Also to add a couple more resources:

  • vimtutor is a command line program for learning vim
  • vim-adventures.com/ - a game that teaches vim.
Collapse
 
souris profile image
Souris

thanks, that's very useful

Collapse
 
dmfay profile image
Dian Fay

Learn the basics with vim adventures.

Get a plugin manager. I like dein but there are many others such as vundle or pathogen.

Also, get some plugins. Shougo makes a bunch of useful and heavily customizable workflow aids like the fuzzy finder denite, Tim Pope (tpope) does a lot of small efficiency plugins like vim-surround and vim-commentary. Browse some vimrcs and check out stuff that looks interesting.

Don't try to 100% keyboard right from the beginning, it's a great way to hate working with vim and give up:

set mousefocus
set mouse=a

Case-insensitive searching unless your search string contains upper-case letters:

set ignorecase
set smartcase

Easier navigation with long (wrapped) lines:

nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
Collapse
 
rossijonas profile image
Jonas B. R.

As you have heard before, hit you terminal and type: vimtutor is the first step! Take 30mins to 1 hr to practice relaxed, no rush! 👨‍💻

There's a nice book called Mastering Vim Quickly by Jovica Ilic, that is a pretty good one, and If you can't invest right now, youcan subscribe to get chapters for free and newsletter tips.

vimcasts.org is a free good resource with videos and articles.

I started to write quick tips and tutorials for Vim beginners too, to help them deal with specific configs and get excited with tricks you can use.

You can check it on medium.com/vim-drops !

Cheers!✌️👨‍💻⌨️👩‍💻✌️

Collapse
 
voyeg3r profile image
Sérgio Araújo

I suggest:

Collapse
 
skingrapher profile image
skingrapher

Hi, I use vim since 10 years or a bit more. For a beginner nowadays, I would recommand a plugin manager like pathogen (it becomes easy to clone a vim plugin from a public repo as github and use it immediately as a plugin in vim), NerdTree, some linter for syntax, emmet to expand abbreviations, vim-airline for status in vim. There are a lot more but there is only one rule : everything you have in a GUI editor, you can have it in vim with a terminal. Or I guess... ;)

Collapse
 
voyeg3r profile image
Sérgio Araújo

On your ~/.vimrc put

set path+=.,**

So then when your cursor is over a file name like /etc/passwd just type gf
or Ctrl-w f to open it in a new window.

To get back just type Ctrl-6 (this is a shortcut to alternate file) ":h alternate-file" for more

have a look at: vim-bootstrap.com/