First, to (hopefully) prevent misunderstanding, the author says clearly that visual mode is sometimes useful. In particular, he writes that you may want visual mode to “Visually confirm the text you are going to operate on.”
That said, I think it’s interesting that (as I understand it), Kakoune and Helix have deliberately gone entirely in the other direction.
Operations and moves are reversed in Kakoune. First select whatever text you want to operate on, and then use a modifying operation. That makes things more consistent (Vim needs a separate x and d operation because of the operator -> move order, Kakoune only needs the d operation). That also allows more complex selections.
Helix’s editing model is strongly inspired from Vim and Kakoune, and a notable difference from Vim (and the most striking similarity to Kakoune) is that Helix follows the selection → action model. This means that whatever you are going to act on (a word, a paragraph, a line, etc.) is selected first and the action itself (delete, change, yank, etc.) comes second. A cursor is simply a single width selection.
I’m a longtime Vim and Neovim user, and I haven’t used Kakoune or Helix enough to have a strong opinion. But I wonder what people think about these choices. (I’m especially curious to know what people think if they migrated to Kakoune or Helix from Vim or Neovim.)
In my experience, the Kakoune/Helix model has a much lower cognitive load (I don’t have to calculate how many and which text objects to operate on—just delete the selection) and result in fewer undos.
I’ve spent years and years using the vim model (in vim/nvim/emacs and others) but the only thing that has the same thoughtless ease is enabling visual mode, activating leap and acting on the result.
Probably my favorite editing experience has been meow for emacs, which has some subtle differences from the Kakoune/Helix model (mainly that the selection extends by default with certain keys using a heuristic).
I tried briefly to convert from kakoune to meow but ended up going back to kakoune. The multi-cursor equivalent in meow felt unintuitive to me compared to kakoune and didn’t seem to integrate as well with searching and kakounes n/N variants.
However, it could also be that I just didn’t get over the initial learning cliff for meow. Are you still used meow these days or something different?
(I’m not @emallson but) I love meow. I find it to be more of a toolkit than a fully configured solution though. If I wasn’t locked into emacs for other reasons, I might prefer kakoune.
oh yea, the multi-cursor thing for meow took a long time to get used to. i’m currently sort of in-between editors. i’ve been using helix a good bit, but $WORK still uses the IntelliJ suite for a variety of reasons. I’ve started messing around with my emacs config again doing something meow-lite because i really struggled with the key remapping scheme (the only part of meow i really didn’t like—i have a highly idiosyncratic key mapping scheme that incorporates bits from lots of editors and thus fits poorly in all of them)
I used Kakoune for a while. I found the different mode to not be a huge game changer. In practice it felt like I swapped V for caps-lock, as chording keys hurt my hands.
What I ended up liking more about Kakoune was how easy it was to integrate with CLI tools. You could write scripts in awk, sh etc. and have them seamlessly work in Kakoune.
What I ended up liking more about Kakoune was how easy it was to integrate with CLI tools. You could write scripts in awk, sh etc. and have them seamlessly work in Kakoune.
Out of curiosity, how does Kakoune do this better than Vim or Neovim? They are both designed to work with external tools.
Kakoune also has more visual selection filters out of the box. Afaik vim only has ! which always replaces the content. In Kakoune, I can run the visual selection through a cli program and have the output pasted above or below. I used that to generate sql types in ocaml together with awk.
Finally, you can also run Kakoune in daemon mode. That means that it integrates well with file explorers and git explorers like tig. You can use the file explorers to open files and then Kakoune remember the state, what has been yanked etc.
I moved to Helix a year and a half ago, after 20ish years of mostly vim. I was first going to say the absolute difference in usability isn’t that great — just a slight nod to Helix — but then I remembered how Helix does multiple cursors (similar, I think, to kak?), and that it’s something I use a lot and in a way that’s quite tied to how it models selections in general. Things I’d cook macros on the fly for in vim (and be like “how cool it is that I can just paste and yank the register of the macro to see and edit it!” when it hit an edge) I can instead do interactively. It’s a big improvement.
I switched to helix after using vim and neovim for years and I find the helix way more natural. It embraces what I was already doing in vim with visual mode a lot of the time, and makes it insanely powerful e.g. with multicursors, excluding selections by pattern, etc.
As someone who switched to kak 5ish years ago after having been an evangelical vim user since college and never looked back, this article did a great job of reminding me why. Even the “better” versions from this article are longer tgan what I’d use give no feedback until fully executed and feel weirdly lacking in flexibility (id forgotten that something like ‘dk’ignores column position, and that feels wrong now) and I’m not exactly a wizard.
Edit: I guess % is a thing in vim and the author may not have known.
Based on 10 years of developing with Emacs, followed by 16 years with Vim, and now 4 years with Kakoune, I find Kakoune super compelling. In my opinion the author undervalues the interactive feedback that visual mode provides, in particular how it reduces cognitive load and decreases editing errors. Kakoune takes visual mode to its logical conclusion and provides a tool set that I find more composable than any other I’ve used; I am comfortable with combining nearly all of the standard commands to solve problems that would require more esoteric knowledge in other editors.
is, when I do the former, I catch myself after the fact, undo the change, then do it again the faster way. It obviously takes longer to do it twice, but pays off because after only one or two repeats for a pattern I start doing it the more efficient way from then on.
In the end vim is just a software and most of its behaviour is predictable. However I have never been able to convince myself to use sequences like dk because I mistype a lot. Overusing visual mode helps me see the selection that following command is going to work on. This is the premise of the grammar of editors like Kakoune and Helix. I don’t really care if I could do it in 2-3 fewer keystrokes. But I value more that I know what the next keystroke is gonna do.
Somewhat disagree. If you’re trying to learn and visual selection is becoming too much of a crutch, then by all means, use that hardtime plugin to keep you on your toes. But once you’re settled in, please feel free to use visual selections as much as you want; especially in situations that involve manual counting, like in the given example V5jd (selecting the next five lines …); it’s relatively more taxing to manually tally up a count to act upon (with relative numbers enabled or not) than it is to just go down visual selecting, and you can’t deny the assurance of a visual feedback, especially for destructive operations.
BTW another benefit is if you happened to make a mistake while visual selecting your target (like in counting those 5 lines), then gv brings up the most recent visual selection and you can re-target again. If you would’ve asked me when I was learning all those years ago, I would’ve agreed with the post but now I just want to do things the most easiest way possible, that’s where I’m coming from I guess.
That said, there is a suggestion to be made: use text objects as much as possible, get a plugin if you have to. That should lessen dependance on visual selection and increase your ability to target with more ease and clarity.
Going to add that plugin suggested here. I wonder if things like textobjects could help as well. I find them useful when I’m aiming to link to some code but want to get a specific range. A lot easier and direct than holding down or up a few times (or j and k for the more purists, lol).
If you’re on Helix, this is available by default and you also get Alt-n/Alt-p (select next and previous sibling, useful for navigating by expression/statement/function), Alt-i (shrink selection to inner node, for example from statement to expression) and Alt+o (expand selection to parent node, which I use very often to select blocks of code).
Oh, I’ve been locked into (neo)vim for years; haven’t had a real nudge to leave yet (probably because I can’t quit, lol).
Sidenote: I can’t tell if it’s me but the styling of that page seems to be off (white heading text on gray background); at least in Librefox; it might be the resisting of fingerprinting).
From what I’ve seen around and my own experience, Helix has managed to convert many vim die-hards. The good thing is that adapting is not that hard and you get a lot of things for free that you would have to configure yourself in (neo)vim; the bad is that there’s some stuff missing (a proper file browser or tree view is my main complaint, even if the fzf-like file selector is pretty good) and no way to add it in. There’s a plugin system in the works that would solve this last issue though.
vim.api.nvim_create_autocmd("TextYankPost", {
pattern = "*",
callback = function()
-- You can put whatever highlight group you like in higroup.
-- Ditto for the timeout length.
-- See `:help vim.highlight.on_yank()` for more options and details.
vim.highlight.on_yank({ higroup = "Visual", timeout = 300 })
end,
group = vim.api.nvim_create_augroup('highlight_yank', {}),
})
This is a good reminder to reconsider habits in general when it comes to working in vim. I’d admittedly do kdddd before thinking of something like dk or Vdk. It’s really easy to get stuck in your ways with an inefficient workflow because it works well enough to get by.
As someone who switched to kak 5ish years ago after having been an evangelical vim user since college and never looked back, this article did a great job of reminding me why. Even the “better” versions from this article are longer tgan what I’d use give no feedback until fully executed and feel weirdly lacking in flexibility (id forgotten that something like ‘dk’ignores column position, and that feels wrong now) and I’m not exactly a wizard.
Edit: I guess % is a thing in vim and the author may not have known.
In general, the advice is that any range that you can define in visual mode can be passed directly to a command (I don’t believe this is true of visual block mode) and that’s a good thing to remember. I mostly use visual mode for uncommon operations because it comes with a free preview: I know exactly the text that’s going to be modified because it’s highlighted. With unlimited persistent undo, that’s perhaps less important than it was, but it still helps reduce surprises.
First, to (hopefully) prevent misunderstanding, the author says clearly that visual mode is sometimes useful. In particular, he writes that you may want visual mode to “Visually confirm the text you are going to operate on.”
That said, I think it’s interesting that (as I understand it), Kakoune and Helix have deliberately gone entirely in the other direction.
From Kakoune’s migrating from vim page:
From Helix’s migrating from vim page:
I’m a longtime Vim and Neovim user, and I haven’t used Kakoune or Helix enough to have a strong opinion. But I wonder what people think about these choices. (I’m especially curious to know what people think if they migrated to Kakoune or Helix from Vim or Neovim.)
In my experience, the Kakoune/Helix model has a much lower cognitive load (I don’t have to calculate how many and which text objects to operate on—just delete the selection) and result in fewer undos.
I’ve spent years and years using the vim model (in vim/nvim/emacs and others) but the only thing that has the same thoughtless ease is enabling visual mode, activating leap and acting on the result.
Probably my favorite editing experience has been meow for emacs, which has some subtle differences from the Kakoune/Helix model (mainly that the selection extends by default with certain keys using a heuristic).
I tried briefly to convert from kakoune to meow but ended up going back to kakoune. The multi-cursor equivalent in meow felt unintuitive to me compared to kakoune and didn’t seem to integrate as well with searching and kakounes n/N variants.
However, it could also be that I just didn’t get over the initial learning cliff for meow. Are you still used meow these days or something different?
(I’m not @emallson but) I love meow. I find it to be more of a toolkit than a fully configured solution though. If I wasn’t locked into emacs for other reasons, I might prefer kakoune.
oh yea, the multi-cursor thing for meow took a long time to get used to. i’m currently sort of in-between editors. i’ve been using helix a good bit, but $WORK still uses the IntelliJ suite for a variety of reasons. I’ve started messing around with my emacs config again doing something meow-lite because i really struggled with the key remapping scheme (the only part of meow i really didn’t like—i have a highly idiosyncratic key mapping scheme that incorporates bits from lots of editors and thus fits poorly in all of them)
Not so much for text objects, but one of my favorite things in Vim/Neovim is having both the line number and relative numbers.
I can see where I am and how many lines to eg. delete, with no mental gymnastics.
I used Kakoune for a while. I found the different mode to not be a huge game changer. In practice it felt like I swapped V for caps-lock, as chording keys hurt my hands.
What I ended up liking more about Kakoune was how easy it was to integrate with CLI tools. You could write scripts in awk, sh etc. and have them seamlessly work in Kakoune.
Out of curiosity, how does Kakoune do this better than Vim or Neovim? They are both designed to work with external tools.
As an example, I wanted to have fuzzy find in Kakoune. Combined with fd, I implemented a fuzzy auto complete in Kakoune in 2 lines of config.
Kakoune also has more visual selection filters out of the box. Afaik vim only has
!which always replaces the content. In Kakoune, I can run the visual selection through a cli program and have the output pasted above or below. I used that to generate sql types in ocaml together with awk.Finally, you can also run Kakoune in daemon mode. That means that it integrates well with file explorers and git explorers like tig. You can use the file explorers to open files and then Kakoune remember the state, what has been yanked etc.
I moved to Helix a year and a half ago, after 20ish years of mostly vim. I was first going to say the absolute difference in usability isn’t that great — just a slight nod to Helix — but then I remembered how Helix does multiple cursors (similar, I think, to kak?), and that it’s something I use a lot and in a way that’s quite tied to how it models selections in general. Things I’d cook macros on the fly for in vim (and be like “how cool it is that I can just paste and yank the register of the macro to see and edit it!” when it hit an edge) I can instead do interactively. It’s a big improvement.
I switched to helix after using vim and neovim for years and I find the helix way more natural. It embraces what I was already doing in vim with visual mode a lot of the time, and makes it insanely powerful e.g. with multicursors, excluding selections by pattern, etc.
I didn’t know about Kakune nor Helix so thanks for posting this — these two projects sound intriguing, I’ll definitely try them out
As someone who switched to kak 5ish years ago after having been an evangelical vim user since college and never looked back, this article did a great job of reminding me why. Even the “better” versions from this article are longer tgan what I’d use give no feedback until fully executed and feel weirdly lacking in flexibility (id forgotten that something like ‘dk’ignores column position, and that feels wrong now) and I’m not exactly a wizard.
Edit: I guess % is a thing in vim and the author may not have known.
Based on 10 years of developing with Emacs, followed by 16 years with Vim, and now 4 years with Kakoune, I find Kakoune super compelling. In my opinion the author undervalues the interactive feedback that visual mode provides, in particular how it reduces cognitive load and decreases editing errors. Kakoune takes visual mode to its logical conclusion and provides a tool set that I find more composable than any other I’ve used; I am comfortable with combining nearly all of the standard commands to solve problems that would require more esoteric knowledge in other editors.
The way I stop running commands like
and replace them with
is, when I do the former, I catch myself after the fact, undo the change, then do it again the faster way. It obviously takes longer to do it twice, but pays off because after only one or two repeats for a pattern I start doing it the more efficient way from then on.
This is likewise how I build improved muscle memories. Same with outright disabling functions/keys/etc. I want to learn to avoid/replace.
In the end vim is just a software and most of its behaviour is predictable. However I have never been able to convince myself to use sequences like
dkbecause I mistype a lot. Overusing visual mode helps me see the selection that following command is going to work on. This is the premise of the grammar of editors like Kakoune and Helix. I don’t really care if I could do it in 2-3 fewer keystrokes. But I value more that I know what the next keystroke is gonna do.Somewhat disagree. If you’re trying to learn and visual selection is becoming too much of a crutch, then by all means, use that hardtime plugin to keep you on your toes. But once you’re settled in, please feel free to use visual selections as much as you want; especially in situations that involve manual counting, like in the given example
V5jd(selecting the next five lines …); it’s relatively more taxing to manually tally up a count to act upon (with relative numbers enabled or not) than it is to just go down visual selecting, and you can’t deny the assurance of a visual feedback, especially for destructive operations.BTW another benefit is if you happened to make a mistake while visual selecting your target (like in counting those 5 lines), then
gvbrings up the most recent visual selection and you can re-target again. If you would’ve asked me when I was learning all those years ago, I would’ve agreed with the post but now I just want to do things the most easiest way possible, that’s where I’m coming from I guess.That said, there is a suggestion to be made: use text objects as much as possible, get a plugin if you have to. That should lessen dependance on visual selection and increase your ability to target with more ease and clarity.
Going to add that plugin suggested here. I wonder if things like textobjects could help as well. I find them useful when I’m aiming to link to some code but want to get a specific range. A lot easier and direct than holding down or up a few times (or
jandkfor the more purists, lol).If you’re on Helix, this is available by default and you also get
Alt-n/Alt-p(select next and previous sibling, useful for navigating by expression/statement/function),Alt-i(shrink selection to inner node, for example from statement to expression) andAlt+o(expand selection to parent node, which I use very often to select blocks of code).Oh, I’ve been locked into (neo)vim for years; haven’t had a real nudge to leave yet (probably because I can’t quit, lol).
Sidenote: I can’t tell if it’s me but the styling of that page seems to be off (white heading text on gray background); at least in Librefox; it might be the resisting of fingerprinting).
From what I’ve seen around and my own experience, Helix has managed to convert many vim die-hards. The good thing is that adapting is not that hard and you get a lot of things for free that you would have to configure yourself in (neo)vim; the bad is that there’s some stuff missing (a proper file browser or tree view is my main complaint, even if the fzf-like file selector is pretty good) and no way to add it in. There’s a plugin system in the works that would solve this last issue though.
Maybe people already know this, but (at least for yanking) there is a compromise between visual-first and no feedback.
For Vim, you can use vim-highlightedyank.
For Neovim, you can use the builtin
vim.highlight.on_yankin an autocommand.This is a good reminder to reconsider habits in general when it comes to working in vim. I’d admittedly do
kddddbefore thinking of something likedkorVdk. It’s really easy to get stuck in your ways with an inefficient workflow because it works well enough to get by.As someone who switched to kak 5ish years ago after having been an evangelical vim user since college and never looked back, this article did a great job of reminding me why. Even the “better” versions from this article are longer tgan what I’d use give no feedback until fully executed and feel weirdly lacking in flexibility (id forgotten that something like ‘dk’ignores column position, and that feels wrong now) and I’m not exactly a wizard.
Edit: I guess % is a thing in vim and the author may not have known.
In general, the advice is that any range that you can define in visual mode can be passed directly to a command (I don’t believe this is true of visual block mode) and that’s a good thing to remember. I mostly use visual mode for uncommon operations because it comes with a free preview: I know exactly the text that’s going to be modified because it’s highlighted. With unlimited persistent undo, that’s perhaps less important than it was, but it still helps reduce surprises.
[Comment removed by author]