How do I create cursors around a selection?

Let’s say I have code that looks like this:

echo hello world

Lets say that I highlight/select the hello world part. How do I then put two cursors like this?

echo hello world
     ^          ^

That way all I have to do is i"<esc> and I’ll end up with:

echo "hello world"

If I use <a-S>i"<esc> then I’ll end up with almost what I want:

echo "hello worl"d

Edit: fixing typo
Edit: adding with <a-S> doesn’t work for this

Did you know that you can use a to append to the end of a selection? This comes in handy with a comma separated list because you can split to select each item and quote them simultaneously. Or use different text for begin and end like braces.

Yep! This is pretty nifty for the reasons you mentioned. What I’m really curious is for a behavior almost like what <a-S> does. I’ll update my main post to explain why <a-S> doesn’t work.

You were almost there:
exec -draft L <a-S> i '"' <esc>
For surround-like plugins search kak mirror or kak surround on github.

1 Like