In Kakoune, is there a way to type something over and over?

187 views Asked by At

In Vim, you can go 30i=<esc> to type 30 = signs. (This is handy for taking notes, becaus I like to put a bunch of equals signs under different section headers.)

Is there a way to do this in Kakoune? A numerical prefix on an insert session only types the content once.

2

There are 2 answers

2
larsks On BEST ANSWER

There's some discussion of this topic here, where the most relevant comment seems to be:

Since #4041, we can create overlapping selections with the + command and Alt + + to merge them.

Example – Insert 80 asterisks:

80+i*<esc><a-+>

I can't quite get this to work myself (it does create a line of 80 * characters, but I'm not able to exit whatever mode I've gotten myself into at that point), but I haven't used kak before, so perhaps it will be more obvious to you.

0
François Tonneau On

I wrote a simple plugin for Kakoune that does what you want:

Insert a character n times in Insert mode

The good thing about it is that you can use it while writing--no need to interrupt the flow by leaving Insert mode before reentering it. It may also be more finger-friendly than the new + and Alt-+ combinations.

(By the way, this plugin is mentioned in the Discussion that larsks refers to.)