0

A programmer here.

I use my favourite IntelliJ Idea, Notepad++, occasionally Visual Code as it depends whether I program in Java, React or do some automation and scripting.

There is a huge hype about Vi/Vim editor as well as internet meme jokes, mostly about how a beginner user is not able to exit it. It event has also an own question on StackOverflow which proves using such tool is anything but easy.

Moreover, as a guy who doesn't belong among the top-accurate typers, I easily make a typo, and instead of typing correctly a sequence of :wq to save and exit or a particular one-key shortcut operation, I might hit a wrong key and screw it all up. Navigating through Vi/Vim is also not easy and one has to remember a lot of commands and shortcuts using various characters... which reminds me Regex.

I believe Vi/Vim is useful indeed, but I cannot see the good it brings. When one would find beneficial using such editor and how does it?

5
  • Welcome to Vi and Vim! Unfortunately, as it stands, your question is probably too broad and opinion based... The Stack Exchange model is not best suited for this kind of question. Not really sure how you could address that to make the question more focused, with a clear objective... – filbranden Sep 10 '20 at 11:56
  • Although this question is truly an opinion-based one, I believe it's worth to be reopened and answered. – Matt Sep 10 '20 at 13:12
  • How is this question more off-topic compared to for example this one on the LaTeX SE? – Nikolas Charalambidis Sep 10 '20 at 13:17
  • 2
    @Matt I think since I got to answer it, others ought to be able to as well... Reopened. – filbranden Sep 10 '20 at 13:19
  • @Nikolas The question is not really off-topic, but it can be viewed as too broad (asking about how Vim is different from IDEs, well which IDEs? There are many differences, how to narrow down? Which ones matter to you?) and opinion based ("likely to be answered with opinions rather than facts and citations.") I feel the answer I wrote is borderline my opinion, though I tried to capture arguments you'll read often in Vim advocacy pieces (though I'd probably be reluctant to reference any of those materials here.) – filbranden Sep 10 '20 at 13:25
4

This question is a bit too broad and opinion based, but I'll still write an answer here (rather than essentially do the same in comments.)

A lot of the hype around Vi/Vim is on its modal interface, where you get a very rich set of motions, commands, text objects, since you have all keys available (they don't insert outside of insert mode) to implement a wide range of very specific motion and editing commands.

The second advantage of the modal interface of Vi/Vim is composition, which allows you to put together different editing commands with different text objects and add an optional count or a few modifiers, to very effectively act on specific blocks of text. You're able to do all this efficiently without using a mouse or arrow keys, so your hands don't have to move a lot, reducing strain and allowing you be quicker while moving around, editing and typing.

While there's an upside here, there's also a downside in that the Vim modal interface can be quite daunting to a beginner and contributes to the steep learning curve of Vim. It's very efficient once you're proficient in it, but it takes a lot of effort to become really proficient...

(Note also that you have extensions implementing the Vim key bindings and modal interface in most modern IDEs, so you can get this benefit elsewhere without having to switch to Vim.)


Second big feature of Vim/NeoVim (much more.than the original Vi) is extensibility through the built-in Vimscript language and through its plug-in subsystem.

It's "easy" to customize Vim and you can just write mappings, commands and functions to your vimrc and have them readily available. You can "easily" turn them into plug-ins you can share. There's a very rich ecosystem of plug-ins doing everything from external command execution, asynchronous linting, completion, fuzzy finding, directory browsing and more. You have plug-ins introducing additional motions and text objects, snippets. Also plug-ins for language support, with custom syntax highlighting and indentation.

A lot of Vim itself is defined in Vimscript, so you can customize a lot without requiring patches in the C code of the core or to wait for new features to be shipped.

There's a downside here, in that Vimscript is a language full of quirks, starting even with how certain characters are allowed or recognized differently in specific contexts. (Strings can use double quotes, but " is also used to introduce comments. | is the command separator, but some commands consume it and use it as an argument instead.) Not to mention that it's one more language you have to deal with... NeoVim is switching to Lua as a primary language in plug-ins, but it somewhat feels that now you have to deal with both Lua and Vimscript, so not sure how much easier that is right now...

(Note also that modern IDEs typically support extensions too, so you get a lot of this rich ecosystem there too. I guess the main difference here is how with Vim plug-ins are essentially just a continuation of your vimrc config, so it's somewhat natural progression for you to write them as you learn more and become an expert on Vim/NeoVim, while with IDEs it's perhaps not that much exposed to users of the IDE.)


Third big feature of Vim is being lightweight and ubiquitous. It's very lightweight in being very fast to start up. It's very responsive while editing text. The fact that it works well on a terminal (and that's probably the UI of choice of most Vimmers) means you can easily use it through SSH on a server anywhere. The modal interface is also.quite helpful when there's latency in your connection, as you can type ahead and your brain figures out where you're moving precisely, you don't have to count how many characters there are to press the arrow keys that exact number of times...

Vim is also very ubiquitous, especially nowadays when Linux is the platform of choice for servers, the cloud and containers. Vim is pre-installed on virtually every Linux server and cloud instance and many container images ship it too. Even when it's not there, it's usually easy to pull it in. On the desktop and laptop, the popularity of Mac OS (over Windows) in the last decade means it's also shipped by default there too. Out of the box, you get a decent terminal and a working version of Vim you can already start using right away. And if you're on Windows (or even an old Unix box like AIX or HP-UX), you can get installed and running there too.

The fact that your config is all made of a directory tree of text files makes it easy to bring it with you anywhere and automate setting up Vim for your particular preferences.

Having said that, one downside here is that if you get very specialized into Vim, setting it up just right can get quite involved. Even color schemes sometimes (often?) involve coordinating the color scheme of the Terminal with that of Vim. You're likely to want to upgrade Vim to the latest version and install Vim with additional support for Python, Ruby, Lua, so your plug-ins that require those features will work. Vimmers will also often configure their keyboard differently so they have control keys available elsewhere (like remapping the Caps Lock key to Escape or Control.) And don't get me started on clipboard integration 😂


In conclusion, these are the three primary features that make Vim attractive to me over an IDE:

  • the modal interface
  • extensibility and the rich plug-in ecosystem
  • lightweight and ubiquitous

To some extent, you can get a few of those in modern IDEs, particularly Vim keybindings and the modal interface will be available in virtually every modern IDE. Most modern IDEs support extensions and offer a wide variety to select from. On being lightweight and ubiquitous, I think Vim still wins hands down, but perhaps that's not as important a requirement to everyone. (It happens to be a big one for me.)

6
  • 1
    Thanks for a great answer! Do you know what roles in a SW industry tend to pick Vi/Vim? – Nikolas Charalambidis Sep 10 '20 at 13:19
  • 1
    @Nikolas I come from a SysAdmin / DevOps / SRE kind of background and there's where the ubiquitous aspect of Vim is really important. On the SW development side, it depends a lot on team culture and programming language choice. For instance, it used to be that writing Java in Vim was a fool's errand, especially when the IDEs had so much support for Java that were hard to recreate in Vim. Not sure if that's still the case with Java or not, or applicable to other languages. I can imagine .NET is similar, benefits from a tight-knit closed ecosystem. – filbranden Sep 10 '20 at 13:30
  • 1
    Vimscript is a language full of quirks Some of them have been fixed in Vim9 script. For example, in a string slice, indexes no longer describe bytes, but characters, which makes it much easier to operate on multibyte strings. See :h expr-[:]. – user938271 Sep 11 '20 at 0:46
  • 1
    Strings can use double quotes, but " is also used to introduce comments. This is fixed in Vim9 script. For example, this doesn't work in Vim script legacy :put ="string", but it does in Vim9 script. | is the command separator, but some commands consume it and use it as an argument instead. Suppose you could change the design; how would you fix that? Suppose you want to run :g/pat/d | t$. If :g doesn't consume the bar, how would you tell it that it should run :d and :t$ on each line matching pat? – user938271 Sep 11 '20 at 0:46
  • 1
    @user938271 I agree that Vim9 script will fix many of the quirks of the language, as you mentioned. But as you also mentioned, some of the quirks (such as the behavior of | depending on the command it follows) are ingrained in the design, particularly as it inherits a lot from the original Ex command-line. And perhaps that's fine, most (all?) languages have their quirks... But I think you would agree that Vimscript is generally hard on beginners and many times stumps even seasoned developers, no? – filbranden Sep 11 '20 at 1:25
4

The question is pretty much the answer already. But let's explain this.

I use my favourite IntelliJ Idea, Notepad++, occasionally Visual Code as it depends whether I program in Java, React or do some automation and scripting.

So this makes at least three different text editors for a single OS. Doesn't it feel like a problem? Perhaps, the main reason which made you to ask this question at all? Oh, on the other side, Vi/Vim is a truly universal tool under all circumstances and platforms. It's even installed by default almost everywhere except Windows.

There is a huge hype about Vi/Vim editor as well as internet meme jokes, mostly about how a beginner user is not able to exit it.

Every joke is a joke until some extent. The real problem is that people don't want to learn "a text editor". And, in fact, they have the point: an editor is a supplemental tool and no one likes to spend more than an hour for learning it. Hence everyone silently expects that "all text editors are the same", and so at least one of "Ctrl-Q", "Alt-X", "F10" or "Alt-F4" works. But that's not the case for Vim, as there's Vi/Vim and there are all other text editors in the world.

So Vim is not so hard to deal with, but you must be ready to the whole idea "you have to learn a text editor". Are you? Not "copying someone's vimrc, installing a hundred of plugins 'just in case' and creating two hundred mappings 'I can't remember which is which'", but to learn, to understand, and, God forbid, finally to read that dreaded user manual and a couple of books for beginners?!

Now to "what Vim will give to you compared to other editors". In fact, it's not really much at the beginning. But in the course of time you'll hopefully find it to be universal, extensible, stable, generally available and... having very elaborate and ergonomic interface. In fact anyone getting used to "the Vim way" never wants to get back to any other text editor. Because only in Vim you feel like finally doing it the right way ;-)

Of course, there is a ton of features in Vim, but they are not exclusive and you can find them in other editors too. So an essential point is if you're willing to learn and are ready to fully change your editing habits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.