Live data from Hacker News

Learn Vim (2021)

github.com

171–180 of 215 posts

Re: Learn Vim (2021)

#171
post #104

I'm using vim for 10 years and I know I have a lot of "bad" habits that I'm trying to eliminate, but it's hard. For example: 1. instead of doing 4j I might do jjjj 2. if I'm in the middle of a word and want to change it, I'll do bcw instead if ciw 3. if I want to copy 3 lines, I'll do Shift-V+jjj+ESC, instead of just 3yy 4. (possibly other 100 items here...) But I find it very hard to change those habits. Anyone else…

Unconsciousness is not good at doing even simple math like counting, so habits like 4j or 3yy are hard to form. It may even be counterproductive as non-trivial efforts to establish such habits will have cost. Less efforts will be spent on forming habits of spotting bugs in the code.

As in my other comment: what if you use relative line numbers though?

Re: Learn Vim (2021)

#172
post #167

Earlier quoted context omitted.

Only after learning vim you realize how clumsy and slow this is.

I used vim for 5 years, afterwards I switched over to Emacs, and I couldn't disagree with you more. What's clumsy and slow is having to switch between insert mode, normal mode, and visual mode hundreds of times while working rather than just using modifier keys for special actions.

If you're entering normal mode for one or two commands at a time, that could be problem. However, if you're fast at entering normal (i.e. use jj, fd, Caps Lock as Esc, etc.), that's not a meaningful overhead.

On the other hand, having to constantly hold Control/Alt, including long chords (e.g. with prefix + count), feels much worse for me. I use Emacs keybinds on the terminal (outside of vim), but I can't imagine having to constantly press modifiers. It's not as comfortable as switching to a mode where those actions are explictly first-class.

Re: Learn Vim (2021)

#173

Earlier quoted context omitted.

Well, I'm not really sure if we're talking about the same thing. If you're talking about language integration, I've got no quarrel with that (see my earlier comment). The experiences I was referring to are more along the lines of text manipulation in general, not "rename class", "extract method" and the like. If you're talking about features like that, I'd readily agree with you: Trying to do the same thing with Vim…

> If you're talking about language integration, I've got no quarrel with that I am. Because we are talking about these mythical Java programmers who couldn't do something that Vim would have done in seconds > I won't beleive your assertion, however, that this invalidates the benefits of learning Vim bindings And the reason to learn them is because there's a fairy tale of some programmers not doing the job that we're…

Ah, so we're arguing in bad faith. In this case, I won't try to keep some semblance of a useful discussion going. For your interest, most of our integration tests are written in a cucumber dialect and contain very verbose "business-y" messages passed in and out of the system under test.

But then, I'd guess from your tone that this won't stop you from misreading another comment of mine and accusing me of lying, so I'll just wish you a nice weekend instead.

Re: Learn Vim (2021)

#174
post #167

Earlier quoted context omitted.

Only after learning vim you realize how clumsy and slow this is.

I used vim for 5 years, afterwards I switched over to Emacs, and I couldn't disagree with you more. What's clumsy and slow is having to switch between insert mode, normal mode, and visual mode hundreds of times while working rather than just using modifier keys for special actions.

The difference in manipulating text in emacs vs vscode is day and night though.

Re: Learn Vim (2021)

#175
post #104

Earlier quoted context omitted.

Unconsciousness is not good at doing even simple math like counting, so habits like 4j or 3yy are hard to form. It may even be counterproductive as non-trivial efforts to establish such habits will have cost. Less efforts will be spent on forming habits of spotting bugs in the code.

As in my other comment: what if you use relative line numbers though?

I suspect just by making sure that the cursor never leaves the middle of the screen may help better with habit formation than relative line numbers. This way, when one looks few lines below or above the middle it is easier to associate the distance to the center of the screen with numbers on the keyboard compared with distance to an arbitrary line in the screen. Plus relative line numbers will be perceived by the side vision which is rather poor in humans so they mostly help when one consciously looks into them.

But then the question should be what is the end goal here? Is it faster edits in Vim or is it to get job done?

Re: Learn Vim (2021)

#176

I dunno, I never sat down to learn vim, just used it every day for a couple years. I’m not one of those wizards who is, like, answering stack overflow questions or writing wiki articles, but I get the job done. Is it necessary to learn Vim? Seems like a chore. Is the text editor really a bottleneck for anyone? I find that no matter how slow I type, I need to spend more time thinking of what to type anyway, if I’m doi…

I don't understand this attitude. It's clearly more conducive to solving problems to be able to move around our environment more quickly. It's extremely useful (compared to a beginner who only knows insert and write quit) to understand the different vim modalities as well as a few commands to jump around a file or to perform regex or to call an external command. When you're not proficient with the necessary tools, yo…

I’m definitely not going to try and endorse intentional incompetence.

I think it is just not so tricky in the first place. If you start out with “you can use hjkl for directions, and y for copy, d for delete, these can be combined with directions and prepended with numbers; remember the modes, and :w and :q” vim is already as good as most others editors. Then I’d just start using it, rather than trying to learn from the top.

My filter for when I should learn a new feature is when it solves a task I find repetitive and annoying (or I will make a post on Hackernews that says learning Vim is useless, to get a list of features that people actually use day to day). Since we all have different idiosyncrasies, this filter will be different from person to person, so I don’t really get the idea of a guide.

That said, I’m just describing what worked for me; if someone wants a guide they should go for it, we all learn differently after all.

Re: Learn Vim (2021)

#177
post #100

Earlier quoted context omitted.

What vim can do that emacs often is a little too slow for and IDE:s can't is to have finished even quite complicated incisions and changes to your text before you've become conscious that you asked it to do the thing. This means it can help keep out intrusions about editor maneuvering from your mind at work. Some people see no value to this and fill their vim bundle with plugins that slow everything down a lot, but s…

If you already have Caps Lock remapped to Control, why not just use Ctrl-[ to get back to normal mode? Ctrl-[ is the same keycode as escape in terminals, and it's much easier to reach. For me, remapping jk in insert mode results in lag after typing 'j'.

> remapping jk in insert mode results in lag after typing 'j'

It only creates lag if you actually want to type 'jk'. Otherwise, you keep typing like normal, and it doesn't matter. You should be able to config the delay, too. I use `fd`, and I can count the number I've noticed it.

Re: Learn Vim (2021)

#178

I dunno, I never sat down to learn vim, just used it every day for a couple years. I’m not one of those wizards who is, like, answering stack overflow questions or writing wiki articles, but I get the job done. Is it necessary to learn Vim? Seems like a chore. Is the text editor really a bottleneck for anyone? I find that no matter how slow I type, I need to spend more time thinking of what to type anyway, if I’m doi…

I don't understand this attitude. It's clearly more conducive to solving problems to be able to move around our environment more quickly. It's extremely useful (compared to a beginner who only knows insert and write quit) to understand the different vim modalities as well as a few commands to jump around a file or to perform regex or to call an external command. When you're not proficient with the necessary tools, yo…

This is true for tools in general but I've managed to master vim to the point I can be somewhat productive yet it never feels quite ergonomic. Moreover, I think vim-like UI is holding everyone back nowadays. Learning all the intricacies of vim feels like an exercise in brute-forcing a deliberately user-hostile design.

For example, is it really still OK to have little to no visual feedback when entering commands with range/count prefixes, or to have to fall back to custom commands and configs in order to search for strings containing "/"? Or have commands with tiny edit distance between them do radically different things (e.g. "w! " and "w !")? Vim's modal editing implementation also can't handle non-Latin keyboard layouts so I find myself switching keyboard layouts all the time (e.g. normal mode->insert mode->layout switch->type some text->layout switch->normal mode).

Re: Learn Vim (2021)

#179

Earlier quoted context omitted.

> If you're talking about language integration, I've got no quarrel with that I am. Because we are talking about these mythical Java programmers who couldn't do something that Vim would have done in seconds > I won't beleive your assertion, however, that this invalidates the benefits of learning Vim bindings And the reason to learn them is because there's a fairy tale of some programmers not doing the job that we're…

Ah, so we're arguing in bad faith. In this case, I won't try to keep some semblance of a useful discussion going. For your interest, most of our integration tests are written in a cucumber dialect and contain very verbose "business-y" messages passed in and out of the system under test. But then, I'd guess from your tone that this won't stop you from misreading another comment of mine and accusing me of lying, so I'l…

> Ah, so we're arguing in bad faith.

Yes and no. My very first reply pointed out exactly what I found incredible in your story.

If we're sticking to anecdotal data, over 22 years as a programmer I've never seen those amazing feats of vim voodoo you're talking about.

> But then, I'd guess from your tone that this won't stop you from misreading another comment of mine and accusing me of lying

Really? Misreading? Go and read mu very first comment, will you?

Re: Learn Vim (2021)

#180

I dunno, I never sat down to learn vim, just used it every day for a couple years. I’m not one of those wizards who is, like, answering stack overflow questions or writing wiki articles, but I get the job done. Is it necessary to learn Vim? Seems like a chore. Is the text editor really a bottleneck for anyone? I find that no matter how slow I type, I need to spend more time thinking of what to type anyway, if I’m doi…

I don't understand this attitude. It's clearly more conducive to solving problems to be able to move around our environment more quickly. It's extremely useful (compared to a beginner who only knows insert and write quit) to understand the different vim modalities as well as a few commands to jump around a file or to perform regex or to call an external command. When you're not proficient with the necessary tools, yo…

[deleted]
Post reply on HN