I've wanted to dedicate time to learning Vim for probably a decade now.
When I was just getting started as a junior developer, I remember thinking that the people who used it in their day-to-day were "so cool" and felt a bit of awe at how they achieved what they wanted so quickly without lifting their hands off of the keyboard.
Fast forward to a month ago and I decided to take the leap - I was going to try and use Vim for a solid month and if I liked it, I'd stay with it. If I didn't, I'd switch back to VS Code (which has been my go-to IDE for almost a decade).
The barriers to adopting Vim that I could see going into this:
- steep learning curve;
- the need for plugins for most of the things that come out-of-the-box in IDEs like VS Code or JetBrains (e.g.: editing multiple instances of a word in a file at the same time); and
- choice paralysis because, for better or for worse, there's so many solid plugin options for solving a particular problem that it can be hard to tell for a new person what might be easier to get started with or if one tool is better suited towards a particular workflow than another.
After an initial upfront cost of spending loads of time researching, following a couple of Youtube 'initial setup' videos, reading various Reddit posts, googling "how do I do X in vim" dozens and dozens of times, and just general fumbling around, I feel like I've gotten a decent amount of the basics down.
I'm still spending a little bit of time every week tweaking things or trying to find a new plugin to achieve some functionality that I want, but it's nowhere near as overwhelming as it was at the beginning.
Things I learned
- LazyVim is a great bootstrapped config for folks looking to just get started as quickly as possible rather than build everything from the ground up
- If you are looking to build from the ground up, this video from the Primagean was helpful even though I ultimately ended up going with LazyVim because I wanted as close to an 'out-of-the-box' setup as I could find.
- It does take literally weeks before it starts feeling more natural. You will spend lots of time getting frustrated with how the workflow isn't what you want and spending hours looking for the right plugins to install (and then wrangling with the installation) and keymappings to set.
-
:h user-manual
is a thing in Vim that covers everything. I'd been using Google to figure out how to do things (Reddit in particular was an incredibly helpful resource) and then I stumbled on this at the end of my 3rd week of learning Vim.
Am I happy with my decision to switch to Vim?
Generally, yes.
Don't get me wrong, I still find some rough edges that I need to get used to and learn how to use more effectively (or to find a plugin that addresses things for me), but the main factor that will keep me on Vim is I find that I'm far less distracted and feel calmer using Vim than I was using VS Code.
This was not something that I ever considered would happen when adopting Vim. But thinking about it, I realized that VS Code can be noisy with a standard, out-of-the-box setup.
There are notifications on the bottom right harassing me about something going wrong, some extension they suggest I install based on the language of the file I have open, and various notifications about updates being installed.
Vim has this window that shows up briefly on the top right about plugins with updates that quickly disappears, but otherwise I'm never bothered again until I reopen a new session.
So all in all - I'm currently feeling like this was worth the time investment.
I might feel differently as I start delving more into debugging workflows (VS Code's experience is admittedly pretty nice) but I imagine it's just another thing that'll take a little time to learn and configure.
Top comments (24)
I love it when I see setups where people put everything together from the ground up. LazyVim is just an alternative to I think it's Packer that Prime uses. Did you mean NVChad? I've done the whole ground up thing, but NVChad is just too good!
Dreams of Code on YouTube has a bunch of amazing NVChad tutorials, If you haven't seen them, I'd highly recommend them :)
Keep on trucking and learning! I love seeing people who are willing to put in a little extra work for something they think is cool!
I haven't heard of NVChat but thanks for sending those tutorials! I'll have to check them out one of these days.
LazyVim is a "distro" like NVChad, "Lazy.nvim" is a plugin manager used by LazyVim comparable to Packer. It's a confusing choice of name, but they do pretty much the same thing.
Oh wow. Everything makes sense now π
:h window{Ctrl-D} - this took me forever to find, but it was a game-changer for me. Without Ctrl-D, you just get the basic vim introduction and the definition of a window. When you type Ctrl-D rather than just Enter, you get a list of references to all help entries that include the word βwindowβ. Now you see that there are help entries for βwindow-movingβ, βwindow-resizeβ and a host of other options. I used to think :h was not much help until I started using this.
Great to see new people picking up vim!
Great article and thank you for posting.
When you said:
You are absolutely correct. However, and If I understand you correctly, you do not need to use any plugins in this particular scenario. You could do:
%s/foo/bar/g
To search and replace all instances of foo with bar in a file.
To see more checkout this page
Have a nice day!
You did understand me correctly and I had no idea that I could do that without a plugin! Thank you for sharing that!
Oh wow, welcome to Vim! If you are just getting to
%s
, many wonders await you ahead. Here's something might be of use on that journey. I forgot to note the source for some of these below... as always,<C-g>
means hold down the CTRL key while then pressing 'g'... start the first session of your day with a...:smile
- optional.)Now the useful. Open Vim and press
<C-o-o>
. It will take you directly to your last opened file and last location of the cursor. Yes!Having a shortcut to switch between the last edited buffer and your current one would be very handy. Vim actually has the shortcut for this:
<C-^>
. However, it feels much better if you map this command to Backspace YMMV, for example:nnoremap <bs> <C-^>
q:
# list of vim command historyq/
# window of search history edit/run goto previous searchesgi
# put into INSERT mode with cursor at end of last insert you didgf
# open file whose name is under curor or afterga
# show ASCII value of character under the cursor in decimal, hex, octalg<C-g>
# show file specs info current file, num of words, how many bytes.
# current line$
# last line%
# all lines - same as:[1,$]
.:[range]g/pattern/command
#[range]
is optional, by default it's the whole file, for the command.pattern
# pattern looking to matchcommand
# Ex command to be executed for each line matching the pattern:g/error/d
# delete all lines matching pattern:g!/important/d
# delete all lines NOT matching pattern:3,9t20
# copy lines 3 - 9 after line 20, regardless where cursor is:3,9t$
# copy 3 - 9 to the end:3,9m20
# move lines 3 - 9 to line 20Has there ever been a screen-based editor where you could not do that directly?
I've been editing code for over 40 years and I don't remember one that didn't have some sort of find/replace-all functionality.
How old is teco now? Wikipedia says it was developed in 1962, so would be 62 years old. It was available on a screen in 1964. Teco was line based, iirc, and was a mature tool when I first met it, perhaps around 1979-80.
It had a flexible find/replace which did more than you would imagine. EMACS was originally written in teco macros.
History: This has been your history lesson for today
Moral: Explore the editor before you start adding plugin-ins
I was also wondering about the use of plugins. Sure, you can use them if you wish, but here are a few things that can get you around rapidly!
First press Esc to make sure you are in command mode rather than input mode.
1G - navigate to the top of the file or buffer, regardless of where you are.
Similarly
G - navigate to the bottom of the file or buffer, regardless of where you are.
19G - navigate to line 19; change the number and you can navigate anywhere.
Similarly, w moves forward a word, 5w moves forward 5 words and so on.
h moves left one character; 8h moves left 8 characters.
l moves right one character; *l moves right * characters.
j moves down one line; *j moves down * lines.
k moves up one line; *k moves up * lines.
w moves forward to the beginning of the next word; *w moves forward * words to the beginning of the *th next word.
b moves backward to the previous word boundary; e moves forward to the end of the next word boundary.
:w writes out the buffer.
:q quits the buffer
Wx saves and exits.
To input text, there are multiple input commands; the basic one is i, input mode. Using a instead of i puts you in input mode after the current location; think of it like "append" instead of input.
thegeekdiary.com/basic-vi-commands... is a quick vi cheat sheet.
cheatography.com/dcschmid/cheat-sh... is a similar cheat sheet for nvim - Neovim.
Right here in Dev:
dev.to/socool/nvim-cheatsheet-3bpa
gg β for top of file is my preferred approach. Quicker than going for the number key.
Great page. π
Damn right we are. Welcome to Coolsville.
Vim Visual Cheat Sheet - hamwaves.com/vim.tutorial/
Try vim on adroid phone , in temux. i can surprise how easy to write at least document with screen keyboard. temux are give secret to proper use of vim.The vim h-j-k-l is great because on that key don't have arrowkeys.
My favorit is: u.
Welcome to all you that are just starting in vim/neovim. Here is the best book to help get you started (I've read many of them): wizardsusevim.com/
It is a great resource for new vimers and long time users.
Great, I am using
kickstart.nvim
for neovimI am also exploring VIM these days .