Is there virtualedit or similar flag/switch in Kakoune

I was talking to a friend who is vim-user and he said that if he were to try kakoune, there should certain settings available. This about one of those:

On vim there is virtualedit=all that allows you to put your cursor at any point of the screen, and
anywhere after the line ends for instance. E.g. press j and cursor goes one line down but always stays at the same column, even though next line is short or just empty.

Is there something similar on Kakoune either directly or through a plugin? The discussions here at discuss didn’t seem to contain anything relevant.

You can’t select anything except whole characters. So you can’t go outside of the text or visual select half a tab. Out of curioisty, what’s the use case for this? A quick google suggests it’s mostly for working with tables, for that I tend to type first and then align after with &.

Here’s the nice plugin for you to automate this: listentolist / kakoune-table · GitLab

It’s pretty handy for making ASCII-art diagrams, of which tables are a subset.

It might be possible to do something like this with a plugin, but it probably wouldn’t fit very well in Kakoune’s core since Kakoune leans pretty heavily into treating text as a one-dimensional array of characters: you can select newlines individually, the . regex matches newlines, l on a newline wraps to the next line instead of stopping, the insistence on editing keys doing the same thing regardless of the size or scroll-position of the window, etc. In editors that treat text as a two-dimensional array of characters, something like Vim’s virtualedit makes a lot more sense, but in Kakoune “right” and “down” are the same direction.

1 Like

Maybe a plugin could be made which inserts trailing spaces when necessary and removes them again after leaving the line.