Live data from Hacker News

How Did Vim Become So Popular?

pragmaticpineapple.com

171–180 of 507 posts

Re: How Did Vim Become So Popular?

#171

I used Vi, and then Vim, for a good 15y before I switched to Emacs. I made the switch because I had heard that Emacs let you manipulate your buffers with lisp as one would any other data in a programming language. I find I only really do that when using Org Mode or REST mode, but I'm still glad that I made the switch. The editor is ... mine. Mine in a way that a professional's tool should be an extension of themself.…

> The editor is ... mine

One of the things I like most about vim is that you can use it on just about any remote machine, and even if you don't have your own vimrc the default editor is still really powerful.

Re: How Did Vim Become So Popular?

#172

I’ve been using Vim professionally for like ten years now and I can’t tell you what benefits do I get out it exactly. I still use a mouse and I don’t see what’s so bad about it.the whole home row argument has never been convincing.

This is like someone saying they've used a DSLR professionally for a decade and couldn't say what benefits they get out of it over a point and shoot because they've never done anything other than leave it in automatic mode.

You owe it to yourself to explore and embrace the power of your tools as a professional.

Vi(m) in particular requires a deliberate effort from the user to learn its features, because of how it stays out of the way by design. It's not trying to be discoverable at the expense of experienced users.

Decades ago I tutored someone taking a C++ course who claimed to know vi and insisted on using it for the sessions. They knew how to use vi enough to be a notepad replacement, it was brutal to watch how much time they wasted neglecting to use any of vi's features at their fingertips. If you're navigating with a mouse or arrow keys, and treating vi as no more capable than notepad, you're not really using vi.

Re: How Did Vim Become So Popular?

#174
I started using Vim about 10 years ago. I wanted an editor to force me to use the keyboard in a different way as I suspected it would ease my RSI.

After using Vim as my main editor, my RSI went away.

These days I've gone back to an IDE but I still use Vim for single file editing.

Re: How Did Vim Become So Popular?

#175

Ever year or so I look at the nice sugar that things like VScode or other IDEs have and think "it has vim mode, those nice things would be good to have" - autocomplete, things like that. So I try the IDE and I get so tired of _in the way_ it gets that I just go back to vanilla Vim. Then I think "maybe I'll try these IDE like plugins for Vim" and get so frustrated by the Vim plugin system that its back to vanilla Vim…

What I want so badly is real vim with an easy and expansive plugin system. I get by okay with neovim + Plug, but there's still more friction than I'd like. Bought the Oni2 early access because it looks promising, but its not quite there yet.

Re: How Did Vim Become So Popular?

#176
I've been using Vim more and more in the past few months, but I still use VS Code primarily for a lot of my work. At work, I do a lot of Node/TS stuff, so VS Code just offers a whole wealth of tools that I'm already familiar with. I'm sure I could pimp out Vim to do it just as well, if not better, but I still enjoy VS Code.

Where Vim shines for me is for creating and editing small files. I use vim for my journal, quick edits, and data wrangling when I need to get something into a nicer form (most often scraping links to pipe somewhere else). It's a great interface for editing temporary data.

Also, knowing Vim if you ever need to SSH into a remote machine is a must in my eyes. Nano feels sluggish once you get a feel for Vim, and, as the article mentions, you can fine Vim almost everywhere you go.

Re: How Did Vim Become So Popular?

#177
post #99

Does anyone have a good video comparing vim speed coding vs vscode using built in editor features? I’ve been using vscode for years and the YouTube videos that demo vim features are shallow (like how to enter a blank line - really?). I can do the same thing I have seen in vim videos without memorizing a bunch of strange key bindings all while being able to edit code instantly without changing modes. I would love to s…

copy 10 lines from the current position into buffer q, go to the start of function jnk, copy 5 lines into buffer w, jump to line 10, paste contents of q, contents of w, and contents of q sequentially one after the other: "q10yy /jnk "w5yy 10G "qp "wp "qp now, go to the start of the document and indent the next 20 lines by 10 spaces: 0G .,+20s:^: : ok great, now find JUNK and replace 'a1' with 'A1' in the 15 lines tha…

I find it interesting how we use vim so differently. I'd never type "10yy", I'd use "y9j". I never use "10G", I use ":10" ( = enter for those not familiar). Similarly, "0G" is "gg" for me. Call me a notepad user, but that whole second snippet for me would be "ggV19j>" followed by "." until things lined up correctly. Similarly, the third would have been "V14j:s/a1/A1/g".

Nit pick: "q selects register q. A buffer is a different thing.

Re: How Did Vim Become So Popular?

#178

Does anyone have a good video comparing vim speed coding vs vscode using built in editor features? I’ve been using vscode for years and the YouTube videos that demo vim features are shallow (like how to enter a blank line - really?). I can do the same thing I have seen in vim videos without memorizing a bunch of strange key bindings all while being able to edit code instantly without changing modes. I would love to s…

Between the awkward file navigation and the feeling of building my own editor from the ground up, I just never found it worthwhile to fully commit to Vim. So I work in VSCode in my day job.

What I did take from those efforts, though, was Vim's text navigation key bindings. They are a joy to use and most text editors have some sort of emulator for them. The beauty is in the chording, almost all of which maps to easily remembered mnemonics. Delete everything between quotes? Use di". Change curly brackets to square? Change surround, or cs{[. Once you've gotten used to switching between move and edit modes, you can layer these in bit by bit. At a certain point it becomes second nature and you do feel like you can edit code at the speed of thought. It's a powerful feeling.

Re: How Did Vim Become So Popular?

#179

Does anyone have a good video comparing vim speed coding vs vscode using built in editor features? I’ve been using vscode for years and the YouTube videos that demo vim features are shallow (like how to enter a blank line - really?). I can do the same thing I have seen in vim videos without memorizing a bunch of strange key bindings all while being able to edit code instantly without changing modes. I would love to s…

There's too many little things to mention, they do all add up to be quite significant in the course of programming.

Here's a tiny sample of some stuff I use constantly:

Move cursor forward word at a time: w ignoring punctuation: W reverse: b B

Move cursor to next occurrence of character Z: fZ reverse: FZ

Delete forward to next occurrence of character Z: dfZ reverse: dFZ

Change forward to next occurrence of character Z: cfZ reverse: cFZ (like delete but leaves in insert mode afterwards)

Repeat latest edit from current cursor position: .

A lot of the vi commands are composable, as illustrated to some extent above.

To search for say the next line starting with void: /^void

To delete from the current line up to the next line starting with void: d/^void

Note the similarity to dfZ/fZ from above, it's not 100% consistent but most times you can take a chance composing things as you'd expect and things work correctly.

There are far more sophisticated things too of course, but I'm not writing a vim tutorial in an HN comment.

You can do things like rename a function while rearranging its arguments either file-wide, or on a number of lines, or on an interactively selected visual region, or a section selected similar to d/^void... I presume other editors have such capabilities, but I'm most familiar with vim. In vim the actual renaming and rearranging is done using a regular expression containing backreferences:

  s/old_func(\([^,]*\), \([^)]*\))/new_func(\2, \1)/
You may constrain that to a subset of lines a variety of ways, and on top of that can suffix a 'c' on the end of the substitution regexp to make it conditional and you'll get a chance to interactively yay/nay the substitution at every match in the considered lines. The conditional suffix is a godsend as it lets you be fast and sloppy with your regexps and just skip the false positives.

Re: How Did Vim Become So Popular?

#180
post #23

Earlier quoted context omitted.

Long time vim lover here as well, but I guess I hear often that for a lot of folks, input isn't the bottleneck.

Yes I hear that as well. IMHO most of the time is thinking but when I want to move stuff from my brain to my screen I prefer maximum bandwidth and not having to consciously think about it. To each their own I guess.

Totally. I also find that using it, I'm more willing to externalize my thought process, put code on the screen to reason about it and quickly scrap or modify it if it doesn't work.
Post reply on HN