313 points · by thanato0s · 1w ago · 124 comments
When I started using Vim more than a decade ago, I wished there was a manual out there teaching how to use this fantastic editor step by step, beginning with the foundations up to more advanced features. Of course at the time I did the vimtutor, but it was too dense for me to remember much from it. I also read the entire Vim manual (`:help manual`), but I didn't like it: it was too detailed in places (for example `02.8 Finding help` completely lost me for a while), and other features didn't get the treatment they deserved.
So I decided to write my own Vim manual. It took me more than 4 years and 2987 focused pomodoros (1244 hours) of work to finally get it done!
The result:
- 21 chapters showing the most important Vim features step by step.
- 170 exercises with solutions.
- Many real-life examples to show how Vim can be used and configured for your own needs.
- The related Vim's help pages to dig further into each feature.
Most configs are both written in Vimscript and Lua for Neovim users. This book explores the common features between Vim and Neovim, so don't expect anything about Neovim-specific features (like treesitter or LSP for example).
- The landing page: https://themouseless.dev/vim/
- A sample of the book with the entire table of contents and the first three chapters covering most of the basics: https://themouseless.dev/content/learning_to_play_vim_sample....
I wrote this with my bare hands, no LLM involved to spoil the fun.
To me the biggest difference between old grown human writing and LLM: the intent, and the will to try to be accurate. LLM accuracy is often good when it has the data; when it doesn't, it's just a salad of bullshit.
LLM texts are often impenetrable text walls that were usually written not to be read but just to exist. And if the prompter doesn't care and doesn't even read it, it's even worse.
That's why I despise LLM-generated documentation, it's horrible to read.
I think I know what you mean, but this seems contradictory:P
Maybe I use these words wrongly though, wouldn't be the first time :D
As a motivation for new vim users, I'd like to mention that LLMs make it even more awesome to use such a malleable editor. When I think of some functionality I need, I'll just let Copilot write a small function and key binding and voila, it's done. It's pretty good at vimscript.
Latest example: a key (gK) to show the full git commit message of the current line. Or, when used with a number (e.g. 4gK) the message of the nth previous commit touching that line.
Even before LLMs was all what mattered I couldn't really use bloated external config, because without understanding what is what I can't really know what I need and how to add it...
I like simplicity and controlling my tool, that's maybe why.
The author is sharing something they made, which is new teaching material made by a human (sorely lacking these days), and the top comment is about how someone uses LLMs to do something tangential without learning.
I don’t think there’s a single person on HN who doesn’t know they can use LLMs, no need to keep repeating that at every opportunity.
Nevertheless the use of AI is still unfolding and I haven't yet figured out all the applications it has. So every now and then I stumble upon comments like my original one, and discover a new way to use AI.
Indeed I wouldn't wish for it to be the top comment.
Personally I use Helix whenever I need a decent terminal-based editor (though most of my coding is done in a JetBrains IDE). I found neovim's plugin ecosystem great in theory but fragile in practice - it seems whenever I install a load of plugins to get it working the way I want it and then come back a while later, half of them have broken. Helix is more limited in its capabilities but feels more stable.
However if there is a stable set of plugins out there (and I see you recommend some in the book) maybe it's worth taking another look.
I guess I'll write about all of that soon, but I think it's important nowadays to own our stuff, without necessarily leaking everything to the data brokers. I like local plain text for that; I just don't depend on anything. It's easy to share too, and format like Markdown can be rendered easily.
Also I like spending my time in the terminal, don't ask me why.
Since the efforts of putting vim everywhere are always welcome, I will give some random opinions about it here:
1. The best way of teaching it would probably be a gamified version, not sure if anyone did this yet. People have really low attention spans nowadays. Unless I'm reading a novel or something like that, I will throw text into an LLM to get a summary anyway, even if I feel a bit bad about it (it's just more efficient).
2. Personally I've always referenced people to Luke Smith's (otherwise known as "Vim Diesel") video on vim for beginners to learn most of the useful commands.
I don't think LLMs are the best to generate consistency at the scale of a book. To me it's just a choice between reading human's writing and reading hundred of pages where there is no intention... and maybe full of bullshits. At least my bullshits are due to human error :D
But I mean I don't want this whole thread to be about LLM. It's just about Vim, a cool text editor in the shell.
For the gamified version there is the great https://www.vimgolf.com/, and there is also Vim adventures
EDIT: Also there is the famous snake game where hjkl are the arrow keys: https://themouseless.dev/snake/
funny enough I wanted to develop a game at one point in Clojure to learn Vim, but I never really finished it. Maybe I should do that.
Oh and here's a wayback machine from 2021: https://web.archive.org/web/20211002194931/https://themousel...
Few in contrast remember that vi from the start had forward space (SPC), backward space (BS), next line (⎈N SO) and previous line (⎈P DLE) for navigation in normal mode.
I hope that your vim book teaches arrow keys first, arrow keys being a thing that we've had in the world of terminals since around 1970, the forwardspace/backspace/next/previous next, and the hjkl last. I think that it really does not serve novices to teach them the way to use vim that matches a 1976 terminal that they do not have, and does not match what the modern keyboard that they do have in front of them has.
* https://news.ycombinator.com/item?id=48753333
Don't make the mistake that Dougherty and O'Reilly made in their 1987 book, of claiming that some terminals might not have arrow keys. Even by 1987, terminals without arrow keys had become a rarity, thanks to the PC revolution and whatnot. 40 years later still, that's an understatement.
I'd like to offer a counterpoint. I don't think there is any teaching method that works for everyone. I know gamified Vim tutorials is a thing and a few pop up on "show hn" sometimes. but personally, I lose interest whenever I come across a gamified tutorial. Gamified vim tutorials, gamified shell tutorials, gamified coreutils tutorials. None of them work for me. I immediately lose interest.
But give me a well written book (like the one in this 'show hn') and I'm hooked and I'm happy to spend hours and hours on it, digest it, re-read it, go back to it 5 years later, etc. etc.
Try https://vim-adventures.com/ :-)
Do you actually find that pomodoro method helpful? The idea always seemed a bit suspect to me.
It really depends what you prefer, what tools work for me doesn't necessarily work for everybody.
Are you... me?
I've been reading the sample and have already picked up a few things I was unaware of. I'll definitely be looking at picking up a copy of the full book.
If you like a tool and it does the job correctly without too much frustration, well that's a good tool i guess?
Lay flat makes a huge difference for technical books where you want to experiment as you go, trying the things in the book on your own machine. Sure you can ebook your way there, but it never feels the same, somehow.
Do you recommend reading the noiseless dev environment book first?
I mostly cut Neovim specific stuff. I wanted to speak about LSP and treesitter, but I realized that with Vim native features it was just too much. The book is already quite large when the solutions of the exercises are included, and it would have taken even longer to finish it.
Also these features and Neovim in general are a bit moving targets, so it's difficult to write about it without being inacurate two weeks later.
My biggest regret is to totally skip the Vim's embedded terminal, but I might add that down the line.
I wrote a lot of stuff in my blog before that, and another book. It's just what I like to spend my morning before work; playing with Markdown, latex, Lua, the shell, and write stuff.
I’ve been daily driving vim for about 15 years now so don’t think it’s something for me, but it’s good to see new content being created for the next generation software engineers (although they might only see prompt interfaces 99% of the time).
You wouldn't learn that much from the book I agree, but there are always some details and use case we don't necessarily think about. The book is full with examples (including the solutions of the exercises) so it's quite interesting in that sense for power users.
Learning the basics like getting used to hjkl instead of arrow keys, and knowing how to jump around like to the top or bottom or a relative number of lines, and learning how the verbs work so that you can “delete inner word” diw and “change inner word” ciw, and how to use regex on whole file and on visual selection, and making a block visual selection, and indenting a visual selection, covers a lot of what I do. Also knowing how to record and play short macros is sometimes useful, but I only reach for macros a couple of times a month at most.
I might be less efficient than someone who knows Vim truly inside and out, but I’m pretty happy with what I get out of Vim with what I’ve learned.
I might come back to this book though, to pick up some more knowledge on Vim. But I have some other books to read first, so I’m not going to buy it today or in the next few months.
Where my book can be useful is due to the cheer amount of real life examples in there, not something Vim's help (or even the official Vim manual) is very good at. I hope it's inspirational and give ideas how to configure things even further.
Vim always ended up frozen on me when opening big XML files, one big verbose line each. Just had to delete my tmux session though, not restart everything.
I mean it's not perfect by any mean but it has so many good ideas. It has some heart I'd say.
and yeah Vim is not an OS ;)
For example most developers today haven't even been born when keyboard with arrows drawn on hjkl was discontinued. HJKL is neither intuitive nor ergonomical. Why does it persist as default? Because existing vim people are there for tradition and not good engineering and so are afraid of experimenting and trying new things?
Of course if you can configure your keyboard as you wish it's a different question; you might move the arrow keys around the home rows if you want. But then the deeper you go into Vim the less you use hjkl anyway...
Also, here's a sokoban when you can use arrow keys or hjkl: https://themouseless.dev/sokoban/
Unfortunately the tools used by incident responders are mostly built in GUIs and tabbing through everything is less productive than just reaching for the mouse.
I don’t hate you, mouse. I just have a dream.
I found the inspiration hilarious, don't miss it even if this window manager is not for you.
I couldn't go any further in this damned article. I personally believe the author didn't do their homework: while the rodent is an obvious affliction we must get rid of, it can also stroll around when properly trained, and can be tolerated. It's not reliable, the thing having swinging moods; it can perforate some carpal tunnel directly in the wrist, but it's also nice to pet.
But this sentence is where the author lost me. We install Arch Linux over here. To quote one of my friend: You think he's the danger? I am the danger. Or something.
That being said: scheme mentioned, so the author has at least some taste.
Never been a fan of Vim in the browser, sorry :D I like the real thing in the shell.
I'm not sure what would be the point to have that though... but maybe we don't need a reason. It would be funny to see.
I think a better analogy would be: why my ebook is PDF and ePub only when it could have been readable and writable in Vim. There are answers to that, but it's true that at the end I display Vim doc outside of the tool I'm speaking about.