Range (count) with insert #1106

zaript opened this Issue Jan 3, 2017 · 4 comments


None yet

4 participants

zaript commented Jan 3, 2017


Thank you for great editor!

This is a feature request to have counts work with insert mode.

In vim counts work with insert mode in a following way:
3i= will produce === which is convenient for markdown headers.
{3ik:"v", i} will produce {k:"v", k:"v", k:"v"} which is an easy way to initiate a set.

I could not find similar functionality in kakoune so far.

mawww commented Jan 3, 2017


I have thought of this feature a few times during the development of Kakoune, but it was not implemented because it did not seem useful enough. Its pretty easy to repeat the insertion with ., or copy paste. Another reason was to keep the count parameter for an eventual other use, like inserting only for a given selection.

occivink commented Jan 3, 2017

Interestingly, pressing c with adjacent cursors gives you multiple overlapping selections (is that a bug?) so you can kinda use that to do what you propose:

10:exec ;y%val{count}p%val{count}Ls.<ret><a-space>c gives you 10 cursors.

My quoting-fu is not good enough to turn that into a usable binding though.

danr commented Jan 3, 2017

That's such a nice hack @occivink ! I poked around a bit with it and made it a keybinding:

def -allow-override -params 1 urk %{
    exec -no-hooks \;i.<esc>hyd %arg{1} P %arg{1} Hs.<ret><a-space>c
map global user i %{:urk %val{count}<ret>}
mawww commented Jan 3, 2017

@occivink Overlapping cursors are expected to work in insert mode, the main use case is c. We tend to merge the overlapping ones in normal mode though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment