you can also adapt this one liner
command -range TmuxSession letexecute @a='"!tmux.session '" . substitute(@*,"\n"," ","g") | @a
or if you do not need multiline visual selection change @*
to substitute(@*,"\n"," ","g")
command -range TmuxSession let @a='!tmux.session ' . @* | @a
The @*
register stores current selection. So you can join selected text to any other register with your custom command (a
in this examplefor linux, note that you will lost this register texton windows there could be different naming convention) and then execute it.
The -range
is only to avoid an error if you want to execute this command with range marks, i.e. '<,'>TmuxSession
.
@*
is current selection for linux, on windows there could be different naming convention.
EDIT: easier and not overwritting any register
command -range TmuxSession execute "!tmux.session " . @*