The vi family
119 points by hggh 7 days ago | 52 comments

nineteen999 3 hours ago
I consider my vi/vim skills to be extremely minimalist subset, and probably horribly inefficient, since they were developed to work accross a broad range of UNIX systems (SCO, Solaris, HP-UX, OSF, AIX) and I rarely add anything to my vim configs on top of that other than syntax highlighting.

But I'd still rather use it than just about any other text editor, just for the simplicity of that muscle memory alone. I have way more stuff to keep in my head than I have room for and I can't afford to expend more than about 0.0001% of context on a text editor.

reply
applfanboysbgon 51 minutes ago
> I have way more stuff to keep in my head than I have room for and I can't afford to expend more than about 0.0001% of context on a text editor.

I can't say I agree. To me this is equivalent of saying "I have way more music in my head than I have room for and I can't afford to expend more than about 0.0001% of context on a piano". The tool you use for 8+ hours a day is extremely important and even small gains will pay dividends over the long run. The more efficiently the text editor allows you to do tasks, the more time you have to think about other tasks.

reply
ethagnawl 18 minutes ago
> that muscle memory

Once in a while I will mistakenly dump a string of keystrokes into insert mode or another application. That literal output always amazes me because the construction of those strings is so far removed from my brain's "main thread".

The inverse is if I try to write a helper function or explain to someone else how I did something they observed and I need to methodically document each action. It's like trying to describe how to walk or something.

reply
rmunn 2 hours ago
I never edited the default config much.

But then I discovered https://www.lazyvim.org/. Turns your copy of NeoVim into an IDE.

I still haven't edited the default config much, actually. But now I'm probably 2x to 3x as productive in vim (nvim, now) as before.

P.S. If you decide to check out the LazyVim config, I highly recommend reading https://lazyvim-ambitious-devs.phillips.codes/ all the way through. There's a lot of new keybindings to learn, but Dusty Phillips's book gives you a gentle on-ramp to learning most of them.

reply
rmunn 49 minutes ago
I should mention what is becoming my favorite thing about LazyVim's default config, which is the "flash" or "seek" command (LazyVim maps it to `s` so I think of it as "seek") from https://github.com/folke/flash.nvim. I didn't like it at first as I was used to typing `s` to quickly replace a single character with a bunch of text (as opposed to `r` which replaces it with just one character). But I soon learned to remap my brain to use `cl` where I used to use `s`, and then I learned to love "flash"/"seek" mode.

I wrote about how it works in https://news.ycombinator.com/item?id=48118585 so I won't repeat that here. But if I had to pick my favorite feature from LazyVim's config... well, actually it would probably be something else, but `s` is definitely in the top three by now.

reply
mrweasel 32 minutes ago
The demos of LazyVim looks really nice, and people seem to get a benefit/joy out of it. I gave it a try, but it's a little to much for me.

Right now I think my .vimrc is two lines. That's also sort of silly as I benefit very little from all the things Vim can do.

reply
jauntywundrkind 35 minutes ago
I similarly thank the stars I ran into AstroNVim, which itself is based on LazyVim. Out of the box it has a lot of well integrated/just works pieces. It has a bunch of leader key things setup, and, crucially, a little visual navigator at the bottom of the screen. Going from powerful but invisible to having something I could see was such a help! I'd compare it to moving from tmux to zellij but I'm a pretty happy tmux user. https://astronvim.com/

What really seals the AstroNVim deal for me though is the community packs. People have very thoughtfully integrated support for a huge range of nvim plugins. And it's super easy to install, and they often fit in nicely to the existing out of box experience of nvim. https://github.com/AstroNvim/astrocommunity

reply
userbinator 2 hours ago
Likewise, I'm also not very demanding of my text editor. I used vi on any *nix systems and Notepad (the original one, not the new bloated monstrosity) on Windows for most of my work. Navigation, basic editing, and searching are probably all I need.
reply
elektrontamer 3 hours ago
Same. I barely edit default configs. I also mostly use emulators provided by whatever ide I use.
reply
piekvorst 22 minutes ago
I think that it's wrong to assume that vi is the king of memory muscle. Using mouse-oriented editors can develop strong muscle memory just as well. And if you need simplicity, they'd be much simpler: fewer commands, increased speed.
reply
ventana 3 hours ago
One thing I noticed that with Claude Code and Codex running in the terminal, I tend to use VS Code much less than before, and found myself opening files in vim more often. It just looks like, for me, the agent development brings me back to using the basic tools, like many years ago, before VS Code existed.
reply
JohnMakin 2 hours ago
This is interesting to me. vim was my main editor since the start of my career and I was very fast with it, much faster than my peers with an editor. at the outset of llm’s, I ended up using a plugin that would utilize bindings to help me edit faster. with claude code, and how fast it is making changes across many files, I almost never use vim anymore, or vi, unless I need to inspect files in a container/server.
reply
raimo 3 hours ago
Yes indeed, same here!
reply
helterskelter 2 hours ago
If anyone wanted to write a minimal vi-style helix clone they should call it 'ix', as it's derived from helix, gives a nod to 'vi' and a wink at the turning of vi syntax on its head, like rotating a six to make a nine. Then a descendent of 'ix' could be called 'six', and we'll have come full circle.
reply
be_erik 4 hours ago
The history and endurance of vi is impressive. I never thought I would be using the same editor today that I started using in the mid 90s because it was more l33t.

The comments about LLM contributed code seems like a specific axe to grind that otherwise detracts from a nice history lesson.

reply
ethagnawl 11 minutes ago
The inclusion of comments about LLM generated code don't bother me and will probably be quite revealing (for better or worse) when people read this post in the future.

Also, I have not been following the d2d development of vim closely after Bram's passing but I can't help but wonder what he'd have thought about this approach to development of vim.

reply
normie3000 3 hours ago
> The comments about LLM contributed code seems like a specific axe to grind that otherwise detracts from a nice history lesson.

The existence of vim classic would be hard to explain without reference to LLMs.

reply
rmunn 4 hours ago
I started learning vi around the same time, but in my case (since I was expecting to work on Unix systems for decades, which has proven true) it was "because it'll always be there." I.e. if you're SSHing into a server to fix a problem, it's possible that /usr/bin/emacs won't be there (perhaps the problem you're fixing is that /usr isn't mounting), but you can nearly always count on /bin/vi being available: if you can access the server at all, you will be able to access vi, so at least learn its basic keystrokes, our prof told us.

That advice was not entirely accurate (sometimes vi is in /usr/bin/vi, for example), and the merging of /bin with /usr/bin has made it kind of a moot point. (EDIT to add: Though the fact that busybox includes a basic vi implementation has kind of un-mooted the point, actually). But I first started learning vi because I figured I would need it professionally, and when the modal-editing workflow "clicked" for me, I figured out that I had just learned the editor I would want to stick with for years.

And although vim replaced vi and nvim replaced vim in my finger-macros, that has remained true to this day.

reply
sgtlaggy 3 hours ago
> if you're SSHing into a server to fix a problem, it's possible that /usr/bin/emacs won't be there

You don't need emacs on a server. TRAMP is built-in and can open remote files in a local instance over SSH, SMB, FTP, ADB, or docker/podman.

reply
rmunn 3 hours ago
Never really learned emacs so didn't know TRAMP existed. When was it created? I was given that advice ("vi will always be available on the server") in the late 90's so I'm curious to know if TRAMP was an option my prof didn't know about (or didn't mention), or whether it was developed later and the advice was good at the time.

EDIT: Found http://www.fifi.org/doc/tramp/tramp-emacs.html which mentions that TRAMP started development in November 1998. I would have been getting that advice in late 1997 or early 1998, given when I started my Unix class at college. So the answer appears to be that the advice was actually correct at the time, but superseded sooner than I thought it was.

reply
pmontra 3 hours ago
Yes, I can use TRAMP but as I ssh to the server anyway to run commands, I'm editing the files with vi there. Furthermore I'm sure I don't inadvertently edit the local version of the file instead of the remote one, or that I forget to kill the buffer with the remote file and edit it instead of the local one after a few days. What's on the server stays on the server.
reply
Scarbutt 4 hours ago
The comments about LLM contributed code seems like a specific axe to grind that otherwise detracts from a nice history lesson.

Seems like an interesting fact for those who don't follow the development of vim/neovim.

reply
grebc 4 hours ago
Interesting the history is varied for such a simple tool.

I am but a lowly mouse/GUI user so rarely have to dwell in a shell, but I learnt the basics of vi in my 1st year of university and never forgotten. Gotten me out of many a pickle being able to reliably edit a file quickly.

reply
ivanjermakov 37 minutes ago
Simple tool? Visual text editor is probably the most complicated piece of software in coreutils.
reply
normie3000 3 hours ago
...and presumably quit vi once you're done!
reply
rmunn 2 hours ago
I have typed either :wq or ZZ into so many files in VS Code... :-)
reply
nixass 59 minutes ago
Few days ago I watched a video where a guy wrote the code for Linux USB driver from scratch. In frickin' vi! It was a ride
reply
submeta 20 minutes ago
And he doesn’t use any config it seems. No syntax highlighting, no line numbers, plain white text on dark background.
reply
yu3zhou4 13 minutes ago
There was onivim that was a bit hyped a few years ago but unfortunately it died
reply
kouosi 51 minutes ago
Hi you may want to include neatvi[0] and nextvi[1].

[0]: https://github.com/aligrudi/neatvi

[1]: https://github.com/kyx0r/nextvi

reply
keithnz 3 hours ago
I had a mini holiday job working for (long since gone from NZ) Philips Design and Development Laboratory in 1992. As part of that I worked on some tools for their silicon graphics workstations. I was shown vi, and how to get help and left to it. Tough learning curve! Seemed ridiculous at first, then I developed a mini set of editing skills and got used to it! Still using Vim/Nvim today.
reply
taejavu 3 hours ago
How does an article like this not mention Bill Joy??
reply
ethagnawl 29 minutes ago
Bram is a glaring omission in the vi family tree, too. Though, they'd have to draw the line somewhere (i.e. include nvim creator?) and maybe it's better leave individual people out.
reply
openmarkand 7 days ago
I'm vim poweruser since around 2009. When I use VSCodium (not that much today) I obviously use Vim emulation.

When I use a different editor, there will be lots of jjkk or ,w (I nmap ,w to :w). Habits die hard.

Now I switched to neovim due to the amount of good features I like with it. I use exclusively mini.nvim modules that are awesome.

reply
rekoros 3 hours ago
When I was in college in 2001, I went to the library and checked out Kaare Christian's book called "The UNIX Operating System". One of the early chapters covered vi - I'd telnet into the school's Sun server with a pretty early version of vi (one-level undo) and follow the examples. Never looked back!
reply
classichasclass 3 hours ago
Long ago I wrote my own really incomplete vi subset for the C64 that I really should dust off. But there's a more polished vi clone for 6502 machines, including the C64, Apple II and Atari: https://vi65.sourceforge.net/
reply
keyle 51 minutes ago
I didn't know about vim-classic, I've switched to it now. I can't really notice much of a difference except themes are missing... and fzf needed a fix.
reply
saidnooneever 7 days ago
cool stuff, for a bunch i didnt realise they were really distinct versions!

Use Helix now as the first one that stuck in my fingers though. before that it was always try a lil while and forget it (back to nano...).

Helix i think is like 'user friendly vi' or maybe 'no config vi'. dont need any plugins or weird stuff. everything essential works out of the box (for me)

reply
rbits 34 minutes ago
I really want to use Helix, it clicks with me so much more. But I do not want to learn how to use Helix for development. I want to be able to continue using VSCode. And last I checked, the VSCode extension was not very good. I also use Vim keybindings in Obsidian.

The moment VSCode and Obsidian support improves, I am switching immediately.

reply
16bitvoid 2 hours ago
Helix's selection-action feels way more natural to me than vi/vim's action-selection.
reply
opan 2 hours ago
Had someone else parrot this line to me the other day, but I remain unconvinced. Especially when vim has visual mode, and you often can make a select before doing something to it. v$ to select from cursor to end of line, then d to cut or y to copy. Is that not the sort of thing you mean? Is visual mode in vim just underused?

Recently I was trying to find a good way to delete from the current position backward to another character, like dT or dF followed by the target character. The trouble was they'd leave at least one character behind, either what I jumped to or what I started on. What worked how I want, and was still easy, was just using visual mode. Where "n" was the character to jump back to, I did vFn which selected from my cursor position back to the letter n (and including that n). I could then hit d and delete all of it, no extra character left behind from either end. I remember at first I was thinking "there's gotta be a way to do this without visual mode". Best I could come up with was hitting x after dFn or whatever to get the stray character. I think using visual mode is probably fine, though. Maybe if I were doing this type of edit a lot I could bind some key sequence to do it.

Would it be accurate to say you didn't use visual mode much in vim before you moved to Helix?

reply
rbits 40 minutes ago
Well that's one extra key press for every action. For example, you have to do `ved` to delete the current word instead of `de`. Whereas in Helix it's just `ed`.

Also visual mode doesn't work the same. If I want to delete up to the next word normally I do `dw`, but if I do `vwd` then I also delete the first letter of the next word. I guess in visual mode you'd have to do `vwhd` or `vawd`? Which is 4 keypresses instead of 2, which isn't great for something that I do all the time.

reply
rmunn 52 minutes ago
Something rather similar to visual mode, and which I've learned to like a lot, is the https://github.com/folke/flash.nvim plugin (NeoVim only since it uses Lua). It gives you a commmand you can bind to a key (https://www.lazyvim.org/ defaults to binding it to `s` for "Seek"). Press that key and then type a couple letters that appear somewhere on your screen. All occurrences of the letters you typed will be highlighted (and the rest will be dimmed), and next to each of them will appear a bright, contrasting letter that serves as a label. Type the label character and you will jump to the start position of the text you typed.

Why is that handy? Well, the idea is that you're probably already looking at the point on the screen you want to move the cursor to, so instead of figuring out a complex navigation, you can type a few keys: `s` plus the letters you're looking at. Then pause for a quarter-second, and type the letter that just appeared where you're looking at. The label letters will be chosen such that none of them appear after the text you typed, e.g. if the words "car", "cat", and "can" all appear in your document, then after you press `sca` the labels `r`, `t`, and `n` will never be chosen. (But the label `d` might be chosen if the word "cad", or words containing it such as "academic", never appear in the document).

It took a little getting used to, but now I've found it's quite the fastest way to issue commands. Want to delete everything from here to that closing parenthesis right there? If you're on its matching open parenthesis then `d%` is fastest, but if you're not, then `ds)` followed by split-second pause to see the label appear (in a bright contrasting color), then type the label. Quite a bit faster than `v` plus a bunch of movement, in my experience. Once you get used to it, it really speeds you up.

And when you get down to it, isn't "once you get used to it, it really speeds you up" a description of the entire vi family of editors in the first place?

reply
rmunn 2 hours ago
I think you're right and visual mode is underused. It gives you the best of both worlds: "cw" meaning "change word" for when it's obvious what you're going to be selecting, and "v3wwwc" for "change 5 words" when you discover (by experimentation) that the text you wanted to change actually counted as 5 words due to punctuation, not 3 as you had first thought.
reply
casey2 4 hours ago
Sam isn't graphical there is sam and samterm which sends commands to sam. sam itself is an ed style line editor, where the concept of a line is replaced with a dot. vis allows multiple dots.

It's worth noting that a lot of the text editing done in the vi family are just calls to ed with different ways of doing selections.

reply
DeathArrow 3 hours ago
I have nothing against Vi or Emacs, but since I strongly prefer GUI and mouse over terminal I use GUI editors.

When I don't have a GUI available, I use micro, nano, joe.

reply
opan 2 hours ago
I'm more in the vim camp, but I will say emacs has one of the best GUIs out there. Everything that works in the terminal still works (great keyboard accessibility), plus you get additional benefits, like proper window separation that isn't just a text character drawing an imaginary line (so copying lines of text with the mouse when you have a bunch of splits is easier). There's also image support, you can connect to a server with TRAMP, open up dired, and view remote images right in emacs. I always thought that was cool.

Vim on the other hand never felt like it benefited much from a GUI, or like it had a very good one available. I just use neovim in a terminal.

reply
pjio 2 hours ago
Being able to choose is a good thing. Use what works for you. I prefer the terminal, but not as hard core as switching to a TTY and never see a GUI again...
reply
karel-3d 37 minutes ago
honestly only LLMs can write Vimscript
reply
yanis_t 2 hours ago
It’s funny how many forks aiming to keep it free from LLM-generated code. The luddites are present even in the most progressive parts of the population.
reply
aiscoming 2 hours ago
vi was never progressive, it was "the Ancients knew it better, the present sucks, these kids have terrible taste, return to the one true Past"
reply
nananana9 7 minutes ago
The Ancients did know it better.

I sometimes try working without vim keybindings as it's a pain installing them everywhere. I usually give up the 3rd time I have to delete a function argument and can't dt, or select the body of a function and can't vi{.

For everyone even somewhat decent at vim, having to hold right arrow until the cursor reaches the target is a humiliation ritual, and I genuinely feel second-hand embarrassment and pity when I see people do that.

reply