December 14th, 2024

What Is Vim?

Vim is a text editor recognized for its efficient command structure, influencing mainstream editors. (Neo)vim is its most complete version, with alternatives like Zed and Emacs available for users.

Read original articleLink Icon
What Is Vim?

Vim is a text editor that stands out due to its unique interaction model, which has influenced many mainstream code editors by incorporating a Vim mode. This mode allows users to leverage Vim's efficient command structure across various platforms like VSCode, JetBrains, and Emacs. The essence of Vim lies in its simplicity and efficiency as a language for communicating with the computer, using concise commands such as "diw" to delete an inner word or "cap" to change a paragraph. This structured approach makes it easier for users to remember commands and for computers to interpret them. The (Neo)vim editor represents the most comprehensive implementation of the Vim language, appealing to those who appreciate its command style. Users who enjoy the Vim interaction but seek different features may explore alternatives like Zed or Emacs, which allow for the same command language while offering varied functionalities.

- Vim is a text editor known for its efficient command structure.

- Many mainstream editors have integrated a Vim mode for user convenience.

- The simplicity of Vim commands makes them easy to remember and interpret.

- (Neo)vim is the most complete implementation of the Vim language.

- Users can explore other editors while retaining the Vim command style.

Link Icon 32 comments
By @chrismorgan - 5 months
> There's a Vim mode in every single mainstream code editor out there.

And they’re always frustratingly incomplete and/or buggy. Some motions will be unimplemented, or will behave incorrectly, especially with regards to boundaries around whitespace inclusion or exclusion in a motion. Things you added to Vim and got used to are unavailable, and so your ysa") to put parentheses around the string your cursor is on just doesn’t work. (Lack of vim-surround definitely gets me frequently.)

In VS Code, it maintains its own undo stack, and the interactions between the two undo stacks are terrible and terribly frustrating—yet doing without might be even worse, because they behave very differently.

And too often in a browser context, ^W will close your tab, losing data, rather then being inhibited and erasing the last word, as it should. That one is practically unforgivable in a Vim mode, yet common. That, more than anything else, will make me avoid a Vim mode.

By @kazinator - 5 months
Vim is not only an editing language, but a fast-starting editor with a small-ish native executable, and small run-time memory use.

This facet is typically not ported into other editors that have a Vim mode.

Vim runs natively inside virtual machines and containers, on resource-constrained embedded systems, and on remotely accessed machines.

Another aspect is that Vim can be operated entirely using a terminal emulator, and so can be running on a remote host to which the use only has a SSH or serial connection.

By @mmahemoff - 5 months
Learning Vim early on had a high return on investment for this reason. Years later, I'm still able to benefit from the same muscle memory in modern tools, e.g. Obsidian.

It should be said, though, that most implementations are simplified rewrites of Vim's core functionality. When you use a tool to achieve a sense of "flow", it can be grating for the editor to behave in subtly different ways from expectation, or discover an important feature does not work at all. Also, there tends to be limited, if any, support for Vim plugins.

In the modern era of Vim and NeoVim, it's possible for such tools to use the real version via network protocol, but integration is easier said than done. So far it's mostly been Vim GUI wrappers that leverage the capability rather than independent editors.

I still use Vim mode where I can even if it's a shadow of the real Vim experience. It makes life easier to use the same muscle memory on every shell, editor, and command-line, and not have to worry about learning every new app's idiosyncracies.

By @lambda_lord - 5 months
Helix uses a selection-first action model: you select the word/paragraph/whatever you want to perform an action on, then you change/delete/whatever on that selection.

I think this is more intuitive than the "verb object" model Vim uses: if you get your selection wrong in Vim, you then need to undo the action and try again. In Helix, I can see what I am about to manipulate before I make the action.

I think at this point Vim wins out for being so ubiquitous, but I wish the Helix model took off first.

By @alienchow - 5 months
Vim is this editor that a senior backend engineer told me to go try for a week, when I was still relatively junior. Like really try to remember all the shortcuts, not some half-assed attempt then laugh about not being able to remember <esc>:wq. If I were able to demonstrate fluent Vim skills at the end of the week, he'd gift me his TKL mechanical keyboard with a Vim keycap on the escape button.

It's been 9 years since that challenge, and I'm still typing on the Filco keyboard. Good memories. Although I've since moved on to NeoVim for the LSPs. It's nice that I can freely edit files on any machine for something I picked up in a week.

By @lproven - 5 months
I think this is a classic example of Unix-induced tunnel vision.

Because Vi[m] is just one example of a keyboard-driven UI that has been adopted in other places, whereas in fact there's a more common one that's used by more people on more computers every day... but it's not widely known that it's a thing and it has a name.

It's IBM CUA.

https://en.wikipedia.org/wiki/IBM_Common_User_Access

It is what defines the keyboard interface of MS Windows, and tens of millions of skilled Windows users use parts of CUA every day, from Alt+F4 to close a window to Ctrl+S to save to Ctrl+F to find to F2 to edit.

For blind and visually impaired users it is the sole or primary UI for Windows.

It is also largely supported in multiple Linux and FOSS desktops, such as Xfce, Unity, LXDE, LXQt, MATE, and others.

Sadly, KDE does not implement much of it, and modern GNOME almost none of it.

But it's there and most Gtk desktop apps support some of it -- although Gtk4 is driving that out now.

CUA provides a whole set of consistent keyboard controls for DOS, Windows 3.x, 9x, NT, 2000-11, OS/2, and almost all the Linux desktops until GNOME 3 came along. It has editing keys but also far more.

A skilled person can drive all of a Windows computer, and all apps, as quickly as a skilled Vi[m] user can -- well, can edit text and nothing else.

By @slightwinder - 5 months
> There's a Vim mode in every single mainstream code editor out there.

Is it really a vim-mode, or a vi-mode? I mean, most of those are already very limited, but does any of them actually support vim-specific evolutions/changes?

And isn't the real question here: where does generic modal editing end, and when does vi(m) starts to display its specific personality?

By @AdieuToLogic - 5 months
Vim is efficient, in that there is no need for one's hands to leave the keyboard.

Vim is succinct, in that what is needed often takes less commands than those less frequent.

Vim is pliable, in that can be made to do whatever you wish.

Vim is everything, vim is nothing.

Mastering vim is to find Zen made possible by an exponential command space.

By @danielvaughn - 5 months
I’ve yet to get sucked into Vim, though I’ve given it a shot on a few occasions. I just feel too much muscle memory with whatever you call normal editing. One of these days I want to really stick with it because I do love the verb/action/modifier idea. I’m even building a similar keyboard-driven editor for building UIs. It has commands like “s a i” (select all images), “a t n” (add text element as next sibling), etc.
By @stevebmark - 5 months
Agree that Vim is a language to talk to your computer, but it's not necessarily efficient. Vim is famously an imperative editor: You have to tell Vim the sequence of steps to perform. Clicking your mouse on a position on the screen is declarative: You declare you want the cursor here. With Vim you have to imperatively walk the cursor to where you want to go, or god forbid use something like easymotion.
By @sexyman48 - 5 months
imagine you would remove the functionality that Vim mode in VSCode gives you from Neovim.

imagine you what?

By @ggm - 5 months
Even though I wince at mis remembered muscle memory using it, I still wish nvi had progressed a little further. I mostly turn off vim features. Default cut-paste with code indent is a giant mismatch. It's cruder, and itself a mishmash of non-joy code, but I found nvi suited me well for decades on netbsd and freebsd, and I use it still. I do run the port on osx but somehow each upgrade I find myself slipped back into vim. And on debian and the like.

I live in Emacs for org, and vi for code edit. Happy mix these last 40+ years.

Sometimes it's hard to recall that ex exists, inside vi. But if you do any :command that's where you are. Inside a simpler editor landscape embedded in the visual world.

Ed is a sometimes tool. Always gratifying to use it!

By @wycy - 5 months
Learning vim was one of the best things I did for myself at work. Completely changed everything about the way I work and made me so much faster.
By @hashkb - 5 months
I love this take. I was a die-hard Vim/Neovim zealot... but these days I absolutely love the ecosystem of tools that support normal mode. For so long hand-cramping emacs keybindings were sort-of-standard-in-a-few-places.

If you're not convinced vimming is the best way to interact with your editor, you probably haven't seen a really proficient vimmer.

By @syndicatedjelly - 5 months
I recently gave up on VSCode because the Vim mode is still substandard, missing keybindings, and constantly glitches out in new and fun (read: not-fun) ways. I’m just gonna use NeoVim and program the IDE myself, in a true moment of going super-saiyan as a programmer
By @smusamashah - 5 months
How do you explain "w" and "wq" to save and quit the editor with "verb adjective object" model?

These two and "i" is all I remember about vi. Or is vi a different thing from vim and this model doesn't apply?

By @favflam - 5 months
Is anyone here using Lazyvim? I switched to this from VS code and it feels much more productive and lightweight on my computer.

I never got into VIM before until I saw some Youtube personality using Lazyvim.

By @eonmist - 5 months
To me there was a distinct "aha" moment when the "vim language" suddenly made sense. Makes me think of when kids suddenly discover how to read.
By @linsomniac - 5 months
I was in a PyCon presentation about the Python bytecode when I came up with the idea that vim editing commands are a bytecode for executing text manipulation.
By @beacon294 - 5 months
I've been using vscode in java because of the cumbersome file navigation in bash. Is there easy full tree navigation in vim?

It may also be because the terminal view is much smaller than vscode's smaller navigation font so I can see much less of the file tree in a terminal program such as ranger.

I also never really mastered windows although I did master vim buffers.

I do use tmux.

By @j7ake - 5 months
> There's a Vim mode in every single mainstream code editor out there

Not Jupyter notebooks though (by default)

By @h43z - 5 months
My ode to why speed even matters https://h.43z.one/vimsteps/0
By @FpUser - 5 months
>"Wha Is Vim"

Something I've never learned. Not proud of it but I do not think I am missing anything either. I write native software for Linux for living at the moment.

By @delta_p_delta_x - 5 months
I am too stupid for Vim. The bottleneck is my brain, not my typing speed.
By @gorfian_robot - 5 months
vi is fine. never seen the need to get all fancy with vim.
By @p0w3n3d - 5 months
vim is an operating system that allows also editing files
By @dallbee - 5 months
Cho 55
By @cassepipe - 5 months
Yet another article about vim that does not mention remapping Escape even though it's a dumb historical accident that the most important key is the furthest away from the home row.
By @cutler - 5 months
"Vell Vim's just zis guy, you know"
By @tom_ - 5 months
I guess. Wake me up when you can enable Emacs mode in vim.
By @steve1977 - 5 months
Article mainly seems to talk about vi, not vim. But I guess the author doesn't know where vim is coming from.