Great video demonstration of the power of multiple cursors


Once in a while, I stumble upon the following video and it never ceases to amaze me.
This is a demonstration of workflow involving multiple cursors in… emacs.

If I’m not mistaken, it has not been shared yet on this forum. It last a bit more than 3 minutes, and I consider it a real treat, and hope you’ll like it as well if you’ve never seen it!

I particularly enjoy the last part where the author effortlessly compute the total view times of his videos just by copy-pasting the content of the Youtube page.

Obviously, the author had time to script his demo and rehearse the execution of the scenario, but it results in a very smooth flow which really feels like magic, even for people like us used to deal with multiple cursors all day long.

There are a few additional things that Kakoune can do that are not shown, like sub-selections, or alignment. On the other hand there’s also the last part involving the inline elisp expression (addition, division…) which is really powerful in emacs world.
Also the fact that he acknowledge that macros also have their place is a good way to calm the haters.

Do you think such a video, but made with Kakoune, could have a positive benefit on how people perceive our favorite text-editor?


What he does in the video is basically what Kakoune is about. I use this daily, specially renaming a bunch of files with multiple cursors.

@crdpa I’m interested for the rename stuff related. How do you rename files?

In the case of Emacs, he is presumably working on Dired. As an alternative, I remember seeing some bash scripts around that allow you to open the current directory content in your favorite editor, work on the content as a regular text file (buffer), and rename the files as you save the text file and leave your editor. I am pasting the script I use below. (I copied it and adapted it from the web, but I can remember neither the source nor the original author.)

Notice that this is not Posix-compliant, because we use arrays.

#!/usr/bin/env bash

# This script allows you to rename files by editing the contents of the current
# directory.


# Store filenames into a 'cache' array and an editable 'project' file.

IFS=$'\n' read -d '' -r -a cache < <( ls -1 )

project=$(mktemp ./temp_1_XXX)

for item in "${cache[@]}"; do
    printf %s\\n "$item"
done > "$project"

# Save the edited project file into a 'text' array.

if ! "$editor" "$project"; then
    echo 'ren: files not renamed' >&2
    rm "$project"
    exit 1

IFS=$'\n' read -d '' -r -a text < "$project"

# Read both arrays to move (rename) files one by one.


if [[ $item_count -ne $target_count ]]; then
    echo 'ren: number of files differ' >&2
    rm "$project"
    exit 1

for ((num = 0; num < item_count; num++)); do
    if [[ $item != $target ]]; then
        mv "$item" "$target"

rm "$project"
ls -lh

This script works well enough for me, but it is not foolproof. For example, it cannot handle filenames with line returns in them. So this is not for serious admin work. For a single person working on his/her own computer, however, this works great.

I have moreutils installed on my systems, so I use the vidir command.


Whelp, I didn’t know that existed, and it is awesome.

I use the nnn file browser. It has a bulkrename function that calls $EDITOR.

If i press ‘r’ in a directory, it shows all filenamess in the editor (or only the ones i selected). I just edit the names, save and quit.

I had a bash script i made for this when nnn didn’t have this function, but it was a long time ago and i lost it.

1 Like

This video is quite impressive! I wonder, is there a way to add new selections incrementally like it’s done in the video?


Ctrl+Mouse works as well

You forgot C

You can do it with * to add current selection to search register and then N to add the new occurence to the selections. ( or n to skip to the next one )

I honestly feel like this video pales in comparison to what @gustavo-hms outlined in the thread on iterators recently. Maybe I’ll find some time to translate it to a video like this.


@EpocSquadron I think very short & single example videos would get a ton of traction. If I was making them, I would put them on youtube rather than like ttyrec because youtube is easy to embed into a forum like this… I might make some too!

1 Like

I usually use this script to easily work with incremental selections. It’s just a small addition over the built-in * key, but it comes in handy.

1 Like