Live data from Hacker News

Vim Language, Motions, and Modes Explained (2023)

ssp.sh

101–104 of 104 posts

Re: Vim Language, Motions, and Modes Explained (2023)

#101
post #23

Earlier quoted context omitted.

I've grown up on vi and later emacs, but VSCode is no joke. It does almost everything, and most of it better, and more intuitively. There's no reason to torture yourself with counting characters, words or lines in order to get the delete command correct in one go.

The single most intuitive ah-ha moment I’ve had in Vi was the change verb. Change In : ci( means “change the text within parentheses.” Change unTil : ct& means “change the text until an ampersand.” And so on. It just makes sense. VSCode never had moments like that for me. It’s fine, sure, but it wasn’t anything special.

You may love to learn then: Those aren't part of change.

"i(" is a selector (see ":help object-select"), and it also works with "y" or "d" or even in visual mode. Likewise "t" is a movement that can even be used on its own.

There's also a sibling to "i", "a", that includes the delimiter used, and "t" is a valid delimiter for HTML or XML tags.

Re: Vim Language, Motions, and Modes Explained (2023)

#102

Yesterday, I used vim motions to clean up some JMH benchmark log data to a CSV. It was genuinely so useful to be able to precisely delete and replace based on regexes. I'm sure I could have done with a graphical find and replace, but it was definitely faster via vim, especially after recording macros to automate the repetitive edits.

Yes. So much this. I've also always loved combining that with the macro functionality. Except: Yesterday, I used an LLM (4o-mini-high) to do this kind of task instead and i might never go back.

I considered it, but there were hundreds of lines of data and I cba to verify all of them once they'd been through the LLM.

Re: Vim Language, Motions, and Modes Explained (2023)

#103

The dudes in the https://ytch.xyz Programming channel display their vim editors with all kind of plugins that make me jealous. Pure fireworks. There is a plugin feature that enhances the line number where your cursor is located in the leftmost column for line numbers and looks super cool. I wish I knew the name of that plugin/feature since I don't want to go into the trial an error. I also use the vim plugin for Ecli…

> There is a plugin feature that enhances the line number where your cursor is located in the leftmost column for line numbers and looks super cool. You mean :set relativenumber

I just discovered the relative number after all this years counting lines to yank. OMG. This guy I am talking has that feature up but the relative number in the gutter but also, as he scrolled up and down, the number showing the actual line number was a bit bigger and different color. Maybe he was using neovim? I don't like to highlight the whole line where my cursor is. Its too distracting. But if the cursor non-relative line number in the gutter was bigger or different color, it would be big difference.

Re: Vim Language, Motions, and Modes Explained (2023)

#104
post #35
post #11

Earlier quoted context omitted.

I use both Vim and Emacs, extensively, so I'd just like to share my experience with mode switching in Vim. Personally, I don't find Vim mode switching to be much of a problem while editing text. It has become muscle memory to stay in normal mode by default. After any insert-mode operation, I instinctively return to normal mode. It's just a habit at this point. Take, for example, writing a for loop. I might type: for…

I used Vim for 5-ish years and I kinda got into that mindset, but on occasion I would fail to switch to insert mode (I think by not hitting the i or a key properly, but when in the flow I don't really pay attention to what my hands are doing) and stuff would go haywire. After 5 years of that happening intermittently I got really fed up with it and I started trying various alternatives. I have been using Emacs for abo…

I wonder if it would be possible to write some code to auto switch to insert mode if you press like 3 key in a very rapid succession, while in normal mode ?
Post reply on HN