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.
And thanks for the kind words!
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.
Helix is good too to be honest. It's just my tinkering problems which are not satisfied :D
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 don't know, I just find that staying on the home rows is super comfy. Of course you could map your keyboard differently and put the arrow key closer to the home rows or something, but so many TUI and CLI tools use hjkl I still think it's useful to learn them. And I don't think it's that hard.
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 recommend reading the noiseless dev environment book first?
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 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 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.
but why? surely you didn't write the book directly as a pdf file. Why don't you publish the text source that is already viewable in vim?
I could publish the source that's true, but it's also a bit my little baby i nourished for the past years, so I'd like it to stay my own. I like working in teams, but I also like to do my little cooking on side.
It's also a way for people to support the work I do on my blog. Granted I didn't update it for a while, but now I'll have more time to get back to it.
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.
The rest is learning of the powerful features that exists in vim like registers, macros, the quickfix list, options like makeprg and the concept of compilers, using windows and the sessions,… And there’s the scripting capabilities. Those are what people stay in those editors. Once you craft your perfect tooling, everything else is lacking in some way.
I've also this project of writing multiple vimtutors, one per chapter of the book. I think you can do that in Neovim, not sure about Vim.
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/
It could be (non-exhaustive list):
jkl; - actual resting home row position
ijkl - no hand movement, no pinky usage (also mirrors arrows and controls that are structured that way outside of your keyboard)
asdf - right hand resting home row position
esdf - right hand, no hand movement, no pinky (gamers used to wasd would love it)
Having navigation single key shift away from resting position has no upsides that I can see. It takes premium home row space, except it fits only 3/4. So you either shift your hand all the time, or your index finger is now busy with both right and down and is moving laterally.
And if it's not actually important, why is it on home row and not say bottom row: m,./ - you'd just curl your fingers and access movement without shifting of your hand.
So the explanation today is nothing other than "Our ancestors did it this way and so shall you, youngster. Scientific basis is overrated and we are not trying new things.".
Also jk is quite nice where they at. I read code more than I write it, and if its formatted for 80 columns, I rarely need to go left or right. So using my strongest fingers is quite nice.
Then you embrace search based navigation and wider movements and you find that you rarely used hjkl other than small movements around a small area.
Completely unrelated, but I find this typo interesting.
My suspicion is that you meant to write "old", but phonetically "all" is quite similar, and your fingers just produced the sound in your head. I'm guessing you've been touch-typing for a long time.
It's amazing that the human brain works that way.
Not sure what's happened there. I was writing this on my phone and I do a version of touch typing there with 2 thumbs. Sometimes I start with an idea, type some words, then stop to think more and then restart typing. When rereading (which I don't do often for HN comments) there are always weird typos and grammatical errors.
I'm not a native speaker. I don't do translation in my head, but I have to consciously think about the idea before typing it (other than platitudes like "How are you?" and "You're welcome" which are basically O(1)). My mind dictates and I type. So the interruptions are like time glitches in my typing for another person, but was perfectly reasonable while I was doing it.
That also reminds me when I was at school and my classmates didn't want to do practice exercises with me. I got the habit of only jotting down checkpoints when I solve problems as writing everything would have slowed me down a lot. So random formulas, figures, and numbers keep appearing with no visible links between them.
My point was to illustrate that talking younger people not experimenting or improving is a bit hypocritical when coming from vi/vim community which is comparatively speaking a fossil stuck on first draft from 1976 (designed for hardware that no longer exists) that haven't changed anything for the better because they are already used to something.
I was just raising the point that if vim users refuse to change, it's reasonable to expect people to not change to vim usage.
It's reasonable to expect people to do whatever they want (to some degree of course), and I can only encourage that. There’s no accounting for taste.
You don’t have to break what’s working to create something better. Disruption is not the only way to innovation.
Which is an argument for non-vim users to not learn vim as that would require breaking the working workflow they have.
Personally I would be interested in evidence-based editor. Where actions are structured and put on keyboard not by vibes, but by thoughtful consideration of actual usage. Wouldn't really increase my productuvity, especially not in new era, but it would be interesting to have if only to "feel like a hacker".
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.
That being said, I didn't look at the code of the engine itself, so I don't know for sure. But I know that disabling the highlighting get rid of these kind of issues most of the time.
When it doesn’t match, it’s ok. When it does match you jave to create new structures, adjust their priorities. And for the renderer, every scrolling means reissuing the ansi excape code according to some theme.
All of this are probably bound to the number n of characters in a line. And for big n, that means a lot of operations. Emacs also struggle with long lines.
One possible difference is that my syntax highlighting code was only applied on the text that's actually shown on screen and not the entire line. It came with some limitations like multiline string highlighting being broken, but then again I didn't put in much effort to make it work well.
vim -c 'set synmaxcol=200' my_big_line.xml
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.
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 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.
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.