News for hackers. Stuff that matters.
Re:Show HN: I built an interactive course that helps you lea... by dash2 on Saturday July 09, 2022 @09:57AM (#32035126)
I really want to like vim and I love some things about it, like the ability to move chunks about with only the keyboard. But so many things about it kill me. Like, why can't I hit right at the end of a line, and move to the next line? Who thinks that is a good idea? Also, why do I have to have a special mode to insert things? Having to change modes just seems so complex and unintuitive. And why does the help system never tell me what I want?

The frustration is that probably there are fixes for all these things, which if I were an expert I would know. But meanwhile I can use an ordinary visual text editor and I don't have to learn anything new.

Re:Show HN: I built an interactive course that helps you lea... by yetanotherjosh on Saturday July 09, 2022 @02:00PM (#32037668)
Are you interested in learning a potentially new and more efficient way of doing things? Then you have to stop being annoyed that your habitual way of doing things is unavailable to you, and stop assuming your habits are the obvious and correct way.

The modal nature of Vim is one of it's key features and makes a lot of sense. If you consider the keyboard the primary, if not singular, means of interaction, then there will be times you want to use the keyboard to type text and times you want to use the keyboard to control the editor behavior. In a "normal" editor, you have to use modifier keys to enter commands. In Vim, you do it by changing modes. It's actually quite powerful but you can't get past your own assumptions about efficiency.

Re:Show HN: I built an interactive course that helps you lea... by hasperdi on Saturday July 09, 2022 @03:30PM (#32038466)
>...more efficient way of doing things?

Is that a fact, or you just parroted other people who made similar claim?

Re:Show HN: I built an interactive course that helps you lea... by greenthrow on Saturday July 09, 2022 @06:41PM (#32040012)
It is a fact. The grand parent is talking about slowly navigating around one character at a time. Vim has much more efficient ways to move the cursor to where you want to go.
Re:Show HN: I built an interactive course that helps you lea... by MAGZine on Saturday July 09, 2022 @03:36PM (#32038524)
for me it is a fact.

I still use the mouse from time to time when editing text mind you. But for most actions, I would not think of moving my hand to the mouse, because it is slow.

Even before vim, I made gratuitous use of end of line navigation via keyboard (home/end buttons; cmd+arrow keys). vim is just a more powerful version of those buttons.

I make no claim that vim is the MOST efficient platform ever created, but it's a lot faster than mouse+keyboard and/or out of the box editing methods.

Re:Show HN: I built an interactive course that helps you lea... by hasperdi on Saturday July 09, 2022 @03:50PM (#32038650)
I would like to leave this link to SO page on mouse vs keyboard... You may be faster with a keyboard, but may ONLY feel faster with the keyboard.

https://ux.stackexchange.com/questions/30682/are-there-any-r...

Re:Show HN: I built an interactive course that helps you lea... by cuddlecake on Saturday July 09, 2022 @07:15PM (#32040216)
The link feels irrelevant, because it is not related to vim and text editing. Or does it?
Re:Show HN: I built an interactive course that helps you lea... by wruza on Saturday July 09, 2022 @07:41PM (#32040381)
For me it is not a fact, and I find vim objectively much more harder to use than “regular” editors. But it matches my thinking in a way that I don’t have to plan ahead how many times to press an arrow, or to wait until a key repeat rate gets the cursor where I want it to be. Acquired vim reflexes erase the complexity and leave this benefit.

I always found this “faster” claim somewhat stretched and zealous. I don’t need to type fast. I need the editing routine to gtfo of my mind when I’m programming.

Re:Show HN: I built an interactive course that helps you lea... by AlchemistCamp on Sunday July 10, 2022 @06:21PM (#32049717)
I find it quite a bit faster to type ci] or ci) to replace everything inside a pair of [] or () than selecting the same text through other means. There are similar shortcuts for working at the word, block or "rest of the file" levels and it's all consistent across replacing, deleting and copying actions.

> I don’t have to plan ahead how many times to press an arrow

Usually, I'll just do something, e.g., hit dd to delete a line and then even though I could hit "3." to delete three more lines, I'd usually just repeatedly tap . to repeat that dd action. It doesn't really matter if the action is deleting a line or commenting/uncommenting it or changing capitalization or modifying a word in a certain way. The general strategy of doing the action you want and then repeating with . it is very useful.

Re:Show HN: I built an interactive course that helps you lea... by dimensional_dan on Saturday July 09, 2022 @10:24AM (#32035368)
> I really want to like vim

> Also, why do I have to have a special mode to insert things?

First and foremost Vim is a modal text editor. If you don't like that Vim is probably not for you. Your comment is kind of like saying I'm really trying to like chocolate, but I don't like the flavour.

There's a Vim way of doing things, if you really take the time to learn it then the questions you are asking will all be resolved.

Re:Show HN: I built an interactive course that helps you lea... by gofreddygo on Saturday July 09, 2022 @11:05PM (#32041489)
I really want to like to swim and I love some things about it, like the ability to not sink when thrown in deep water. But so many things about it kill me. Like, why can't I just sit in the water, and float to the top? Who thinks that drowning by default is a good idea? Also, why do I have to have a special way to move my hands and legs? Having to coordinate my limbs just seems so complex and unintuitive. And why can I not see anything underwater? The frustration is that probably there are fixes for all these things, which if I were an expert swimmer I would know. But meanwhile I can use an ordinary kayak and I don't have to learn anything new.
Re:Show HN: I built an interactive course that helps you lea... by palmtree3000 on Sunday July 10, 2022 @03:10AM (#32042521)
I mean, these are all valid criticisms of the swimming experience, it just sounds silly because you can't edit swimming.
Re:Show HN: I built an interactive course that helps you lea... by wruza on Saturday July 09, 2022 @07:32PM (#32040328)
why can't I hit right at the end of a line, and move to the next line? Who thinks that is a good idea?

I do, I hate accidental wrapping on left/right so much and see absolutely no use to it.

But you may configure it, :help 'whichwrap'

Also, why do I have to have a special mode to insert things?

Because if your alphabet keys do always insert, you have to hold some control key to enter commands and movements, and not if not. That’s the point of being modal. Otherwise there are plenty of emacs-alikes to train pinkies on, and no need for yet another notepad+.

Re:Show HN: I built an interactive course that helps you lea... by konart on Saturday July 09, 2022 @10:45AM (#32035565)
> there are fixes for all these things,

No, because those are features, not bugs. If don't want them - you don't have to even think about them.

>Like, why can't I hit right at the end of a line, and move to the next line? Who thinks that is a good idea?

It's not that you can't. The idea behind vim-like navigation is that you don't press those arrows (or hjkl for that matter) in a consecutive manner (or hold) unless you really have to. 99% of the time you jump to some place in the text (a character, or line, a word, a nth line etc).

Re:Show HN: I built an interactive course that helps you lea... by mpalmer on Saturday July 09, 2022 @10:38AM (#32035495)
> an ordinary visual text editor

Funnily enough, Vim is short for "Vi IMproved", and its predecessor vi is short for "visual"!

---

Taking the time to learn Vim yields significant rewards if you're willing to meet it on its own terms. I certainly grant you that it's not for everyone. It's the agony and the ecstasy of deep tools. No pain, no gain.

> The frustration is that probably there are fixes for all these things, which if I were an expert I would know.

I would submit that if you were an expert, you would not have the same list of gripes. To wit:

> Like, why can't I hit right at the end of a line, and move to the next line?

This is a fair complaint, but one that's actually never occurred to me as a Vim user, because:

> Why do I have to have a special mode to insert things?

It's a core part of Vim's design! In fact, insert mode is The other mode (Normal mode) is where the real power is. It's not so much about moving chunks of text around with the keyboard as about moving the cursor.

Vim divides normal mode key commands into motions and operators. operators add/remove/change text, and motions move the cursor.

For instance:

- `d` is an operator deletes text.

- `w` is a motion that moves the cursor to the start of the next word

- `12w` does this 12 times (practically every motion can be repeated like this)

But the rubber really meets the road when you combine them.

If you hit `d` once in normal mode, nothing happens: you've started a command but Vim is waiting for you to finish it by entering a motion. `dw` deletes from the cursor up to the start of the next word (you can guess what `d12w` does).

> And why does the help system never tell me what I want?

Perhaps start with `:help help` :)

Re:Show HN: I built an interactive course that helps you lea... by lovehashbrowns on Saturday July 09, 2022 @02:07PM (#32037742)
These sorta combinations and things like visual block mode are why I can’t let go of vim. You can also do:

set -o vi

And get vim in your bash shell. Then you wonder what the default mode is, and it turns out it’s emacs and you can do wild things like ctrl-A to go to the beginning of the line.

And now I cringe when ever I see someone painstakingly left-arrow for 30 seconds to edit something at the beginning of their bash prompt.

Re:Show HN: I built an interactive course that helps you lea... by ilvez on Sunday July 10, 2022 @01:36AM (#32042142)
Didn't know about that. I'm using default shell shortcuts, which are different set of shortcuts. Like:

* Ctrl-u: clear line and start from the beginning * Ctrl-a: go to the beginning of line * Ctrl-e: go to the end of line * Ctrl-b: move backwards * Ctrl-f: move forwards * Ctrl-c: leave the command as it is, just cancel the command and start with new line * Ctrl-w: delete a word before cursor * Ctrl-h: delete a character before before cursor * Ctrl-d: delete a character after cursor * Ctrl-t: swap last 2 characters (this is one of my favourites in terms of lulz, I actually trained myself to use it :D) * ...

Pulled these out of my fingers, but there are more. Don't know the correct source to point to.

What's good about those is that they work by default and behind every computer.

Re:Show HN: I built an interactive course that helps you lea... by lovehashbrowns on Sunday July 10, 2022 @03:30AM (#32042604)
This is where you can find a reference for the default emacs mode: https://catonmat.net/bash-emacs-editing-mode-cheat-sheet

Unless you’re super into vim, it makes more sense to learn the basic emacs keybinds ‘cause like you said, it’s almost everywhere.

Re:Show HN: I built an interactive course that helps you lea... by artificialLimbs on Saturday July 09, 2022 @10:32PM (#32041321)
>> set -o vi

A million thanks!

Re:Show HN: I built an interactive course that helps you lea... by snet0 on Saturday July 09, 2022 @10:21AM (#32035341)
> why can't I hit right at the end of a line, and move to the next line?

I know this is probably something that sounds like someone too far down the rabbit-hole to see where they came from, but I'm not sure why you'd want to do that. The horizontal movement is probably adjacent to the vertical movement on your keyboard. Just use the appropriate movement to get where you want to go?

> Also, why do I have to have a special mode to insert things?

Because then you can use the regular keyboard, i.e. keys that would normally insert characters, as control inputs.

> But meanwhile I can use an ordinary visual text editor and I don't have to learn anything new.

You don't have to learn anything new because you don't want to do anything new.

Re:Show HN: I built an interactive course that helps you lea... by dash2 on Saturday July 09, 2022 @12:37PM (#32036769)
My answer to all these things is that 90% of the time, I am not using a text editor. I will be writing in Word, or in LyX, or in RStudio, or in a text box. My muscle memory is used to that.

You're absolutely right. You do sound far down the rabbit hole! I am used to being able to hold down the right key and traverse my entire document, as far as I like. Why would I want to stop at the end of a line? Any time I'm editing multiline text - like, say, English - that is essentially arbitrary.

The regular keyboard... right... but what if there were some kind of special key that could be pressed to issue controls? Why is that worse than having a special key that goes into control mode? This is analogous to having caps lock, but no shift key.

Again, you're right, I don't want to do anything new. Why would I? I want to get on with my job. If the response to my complaints is "the problem is with you, my son", without any idea of the ultimate benefits I might gain from changing, then yeah, I'll pass. Honestly, this applies not just to you, but to all the responses below... they're all like "if you try it, one day you will understand". That's probably what people say about Morris Dancing.

Re:Show HN: I built an interactive course that helps you lea... by snet0 on Saturday July 09, 2022 @02:17PM (#32037860)
> I am used to being able to hold down the right key and traverse my entire document, as far as I like.

I mean chances are, if you're holding down a key in vim, you're doing an inefficient movement. That's kinda the point: it's a keyboard language that turns complex actions into compound, simple actions. If you're still using the simple movement and complaining about it not doing what you want, you're just not using vim correctly.

I'm not sure why people get this defensive, though. People like vim, people like editors-that-aren't-vim. Is that not okay? If you don't want to learn to use vim, this link isn't for you.

> but what if there were some kind of special key that could be pressed to issue controls?

This works for a limited number of shortcuts, and when you only want to issue a few. The point is that you can now issue a large number of "command" inputs, very quickly, without holding down a key.

> Again, you're right, I don't want to do anything new. Why would I? I want to get on with my job.

Then uh... don't use vim? Do you post on every "I wrote xyz course for abc language/tool/technology" expressing that you don't want to use it?

Re:Show HN: I built an interactive course that helps you lea... by maleldil on Saturday July 09, 2022 @01:28PM (#32037353)
> I will be writing in Word, or in LyX, or in RStudio, or in a text box.

You might still spend more time editing than writing, and Vim's modal approach makes editing more comfortable to me.

> Why is that worse than having a special key that goes into control mode? This is analogous to having caps lock, but no shift key.

The assumption is that modal editing is more comfortable and powerful. I can traverse the text and make modifications and replacements without holding chords between Ctrl, Alt and letter or arrow keys for long periods of time. Vim's model with text objects also makes some things easier to do than what you can accomplish with chords on editors liks VS Code.

If you spend a significant amount of time writing in all caps, you might benefit from having a Caps Lock key instead of shift.

> I don't want to do anything new. Why would I? I want to get on with my job.

Vim is something that's radically different from other text editors. If you think the learning curve is not worth it, it's up to you. It might not be; it's not like it will turn you into a better writer or programmer. But its uniqueness was enticing enough for me to give it a go, and I realised I enjoyed working with it.

> "if you try it, one day you will understand"

I don't think you should try Vim because it will magically make you a better professional. That's a fantasy some people use to justify the time investment they made to adapt to Vim. I think you should learn it if you're curious, and it's fine if you start learning and decide it's not worth your time. Have you never learnt something just for the fun of it?

PS: If you use VS Code or a JetBrains IDE, I don't recommend switching to Vim. Just do Vimtutor and go back to your regular IDE with a Vim plug-in. VS Code's is pretty good. This is the best of both worlds: you get all the powerful extensions and general IDE goodness while having Vim's Normal and Visual modes. As a bonus, you can still use the regular navigation and editing shortcuts while in Insert mode in VS Code. E.g. navigiating and selecting with Shift, Alt and Command plus arrow keys works like normal, so you don't need to switch modes for small things.

Re:Show HN: I built an interactive course that helps you lea... by mulmen on Saturday July 09, 2022 @09:42PM (#32041101)
You’re asking why this hammer can’t make ice cream. vim is a modal text editor. That’s fundamental. If you don’t like it use something else.
Re:Show HN: I built an interactive course that helps you lea... by blt on Saturday July 09, 2022 @10:19PM (#32041261)
vim is a line-oriented text editor. When using vim, my mental model of the file is an array of (mutually non-contiguous) arrays of characters, not a single array of characters. I expect the same is true for most proficient vim users.

This is clearly a great fit for programming in most languages, but it also works well for natural language. You can put one sentence per line or even split up long sentences into clauses. Then you use the line-manipulation commands to make big edits quickly. Of course, this only works for formats like LaTeX and HTML where consecutive nonempty lines are merged into one line for rendering.

Under the "array of lines" mental model, it doesn't make sense to hold down the right arrow key and traverse the entire document. You move to the desired line first, then move to the desired position in the line.

I agree the two models are basically incompatible. I don't like editing text in non-vim interfaces and will generally open vim for anything longer than this comment.

Re:Show HN: I built an interactive course that helps you lea... by another_story on Saturday July 09, 2022 @09:03PM (#32040877)
I mean it's obviously not the tool for you, so don't use it. I find it for easier to navigate code using the vim modal concept, and can context switch relatively easily when moving over to another editor. I don't think anyone is trying to convert you or will be upset if they fail to do so.
Re:Show HN: I built an interactive course that helps you lea... by VoodooJuJu on Saturday July 09, 2022 @10:32AM (#32035449)
>Like, why can't I hit right at the end of a line, and move to the next line

What do you mean by this? Do you mean the right arrow key?

The mode paradigm was definitely weird to me too at first, but it eventually makes sense, especially when you start using macros.

I agree about the help system - it hasn't been very helpful to me either. I usually am better off consulting stackoverflow or vim's wiki for how to do something.

Vim took me quite a bit of time to learn beyond the basics, but once I learned it, it became a productivity boon. It's nice to have the same powerful text editor available wherever I ssh to, right in the terminal, in the same place I'm using all my shell commands.

Re:Show HN: I built an interactive course that helps you lea... by naillo on Saturday July 09, 2022 @10:02AM (#32035167)
Learning new things is fun and you get used to it. I like the shift A command for moving to the end of the line (and go directly to insert mode). A good tip is to mainly stay in edit mode (and remap caps to escape and hammer that to go back to the default non insert mode whenever you're done).
Re:Show HN: I built an interactive course that helps you lea... by agumonkey on Saturday July 09, 2022 @10:48AM (#32035581)
Have fun in other editors for a while (no need to suffer something that annoys you), and reconsider vim in a year. Its ergonomics can be frustrating at first but the design is sound enough to be valuable, fun even. And I say as an emacs user :)

You don't really move a caret around in vim, you process units of text and lines.

Re:Show HN: I built an interactive course that helps you lea... by juniperplant on Saturday July 09, 2022 @07:33PM (#32040334)
> Like, why can't I hit right at the end of a line, and move to the next line?

set whichwrap+=<,>,h,l,[,]

Source: https://vim.fandom.com/wiki/Automatically_wrap_left_and_righ...

Re:Show HN: I built an interactive course that helps you lea... by bitlax on Saturday July 09, 2022 @10:07AM (#32035204)
Re:Show HN: I built an interactive course that helps you lea... by Silica6149 on Saturday July 09, 2022 @10:10AM (#32035243)
I think most people would agree with you. Being comfortable in your editor of choice and knowing the shortcuts in it will already make you faster than trying to use vim from scratch (at least for a while). Vim definitely needs to be practiced and used more frequently to get up to the same speed as regular editors. However, you can reach (an arguably) faster speed in vim.
Re:Show HN: I built an interactive course that helps you lea... by yjftsjthsd-h on Saturday July 09, 2022 @11:16PM (#32041543)
> But meanwhile I can use an ordinary visual text editor and I don't have to learn anything new.

Then do that?

Re:Show HN: I built an interactive course that helps you lea... by robertlutece on Saturday July 09, 2022 @03:29PM (#32038459)
> Like, why can't I hit right at the end of a line, and move to the next line?

:h whichwrap

Re:Show HN: I built an interactive course that helps you lea... by nomoreusernames on Saturday July 09, 2022 @10:14AM (#32035287)
press o?