top | item 41486293

(no title)

hou32hou | 1 year ago

To be frank it takes time to get used to, especially if you are already a Vim amateur.

However, once you get the hang of it you will find that most common operations can be achieved within 3 keypresses.

For example, to delete the current line, press `e` (Line selection mode) and then `d` (Delete).

To delete the current word, press `w` (Word selection mode) and then `d`.

To insert new text at the end of the current line, press `e`, then `a` (enter insert mode at the end of the selection).

To insert new text at the beginning of the current line, press `e`, then `i` (enter insert mode at the beginning of selection).

To go to the first line, press `e`, then `,` (Move to the first selection).

To go to the last line, press `e`, then `.` (Move to the last selection).

There are too many of such examples that I cannot fit in one comment, but I think you get the idea. It's all about creative combinations between selection modes and movements.

discuss

order

samatman|1 year ago

In Vim:

- dd

- diw

- A

- I

- 1G

- G

Code golfing, I count 12 keystrokes in your example, and 10 in stock Vim.

This is the problem which kak/helix/Ki have with drawing in experienced Vim users: a language is a language, once you know it, you know it, and switching is mostly a drag. It does seem like the "it's better to do it this way" pitch works well enough for those who haven't used a modal editor and are curious.

I disagree with the premise (from the Fine Article) that vi/vim is in some way less coherent as a language. Languages don't really do 'coherent', they do 'expressive'. To get expressive, you need some complexity, and all you can do is hide it in different places.

The argument for Vim's coherence can be found here: https://stackoverflow.com/questions/1218390/what-is-your-mos...

The basic premise of Kakoune, which Ki seems to share, is that it's more natural to move first and then command. That's not how my brain works: I know what I want to do immediately, and it takes more time to express the region I want to do it to (simple things like a line or lines are instant, but would be either way). If I found the opposite more natural, I would use `v` more heavily than I do, and then I might wish to switch. The variety of human minds and personalities virtually guarantees that different people will find one or the other to be more natural.

That all said, I think structural editing is a fine thing, and encourage any and all experiments in modal editing: vim is just a language, not a law of nature, and totalizing attitudes towards language smack of cultural imperialism. Perhaps Vim is stuck in a local optimum, although I don't happen to think so.

So, personally, I might try a structural editor which speaks fluent Vim, but won't otherwise. It's like Dvorak: I see the point in the abstract, but I type around 100WPM without any RSI, I know that switching will make me slower, potentially for a long time, and I'm pessimistic that the final state would be faster: the world record holders use QWERTY.

So I'll just limp along with treesitter objects extensions and hope for the best.

ilyagr|1 year ago

I ended up switching to Kakoune and Dance mainly for the multiple cursor support. I treat it like `sed`, but interactive. It feels miles ahead of other editors I know, with the exception of Helix, Vis, and maybe Ki (haven't played with it enough to tell).

> The basic premise of Kakoune, which Ki seems to share, is that it's more natural to move first and then command. That's not how my brain works:

I also didn't find this as a huge benefit, though some people do. That's why I'm sorry Vis (link in another comment of mine) is not more popular; I could far more easily recommend it to other people if it was as polished as Kakoune and maybe had a VS Code plugin.

---------

Now, for some things I don't fully agree with.

> I disagree with the premise (from the Fine Article) that vi/vim is in some way less coherent as a language. Languages don't really do 'coherent', they do 'expressive'.

I think Vim is definitely less coherent. The first example that comes to mind: it's easy to get to the first line with `:1<enter>` or `gg`, while getting to the last line is `G` for some reason (Update: TIL that `:$<enter>` also works, which makes a little more sense. But `:|<enter>` does not take you to the first line). Getting to the first column is `|` I think? I can never remember it, fortunately `<Home>` works.

Now, where I do agree is that, IMO, it's an open question whether making a modal editor's language more coherent than Vim's would make it more expressive or easier to learn. Vim's language is pretty good. My personal feeling is that Kakoune maybe gets close to Vim's bar, and maybe even exceeds it, but not by enough to make it a fundamentally better language (except for its multiple selection support, where it is fundamentally better).

My hope is that Ki might be better, or that its ideas might lead to a better language. I am not certain this is the case, but it should make the situation I described two paragraphs ago better, at least.

> Code golfing, I count 12 keystrokes in your example, and 10 in stock Vim.

To me, the number of actual keystrokes matters less than how much space they take up in my mind and how easy they are to think of (or, better, perform reflexively). If I typed faster than I thought (e.g. if I was transcribing a voice recording or translating), I might feel differently.

tomtheelder|1 year ago

Honestly I used to feel this way, but ended up using Helix for a few months mostly as an experiment. Now the selection-action version feels just as natural as action-selection used to. I’m sure I could flip it back if I wanted to.

I’m pretty sure it’s not a natural wiring of your brain, but rather long ingrained familiarity.

That said, incredibly marginal value to switching so I wouldn’t bother.

kragen|1 year ago

what's the keystroke sequence to move forward five words, one word at a time (so you don't have to count them first)? in vim it's wwwww, and in emacs it's alt-f f f f f

the asciinema demos are super cool! btw asciinema has an option to record input keystrokes as well as screen output, but i don't know if there's a way to display them in the standard js web player for it

wffurr|1 year ago

I tried but couldn't figure it out from the docs. It's unclear if the selection mode is sticky or is required before each command. e.g. wl would be "next word". I don't know if the command is "wl wl wl wl wl" or "wl l l l l" or if there's a "repeat movement" command.

Update: I installed it and the selection mode is sticky. The command is "wl l l l l"

mroche|1 year ago

> in vim it's wwwww

You may also want to try out <num><action> methods while in normal mode.

    # Move forward 5 words
    5w

    # Move 20 lines up
    20k
The latter paired with relative line numbering can be really handy.

cassepipe|1 year ago

I am a vim user and I wonder what is the use of going five words forward when you can just search for the beginning of the word you want to go to and press enter (even works across lines).

After using vim for a while now I do most of my navigation and editing by searching/replacing