How to make Tmux share only Vim commands and not text?

32 views
Skip to first unread message

Gil Fuser

unread,
Nov 28, 2022, 10:14:38 AM11/28/22
to tmux-...@googlegroups.com
Hi everyone.
This is my first post here.
I should then, first of all, ask you to excuse me for cross-posting. I posted this question in Stackoverflow a week ago and I got very few views, no comments, no votes and I'm afraid it will be lost on the overflow, so I came here hoping for any directions. Here goes the context and my question.

I'm trying to find a way of live-code music together with others, real time and collaboratively, like one would do in a document editor as Etherpad or Google Docs.

I have tried some specific tools for that (e.g: Troop and Flok), but I would like to stay in Neovim.

Then I tried Tmux, which is great because when a client evaluates a block of code that will be done for all clients in that session, but just one person can write at a time and that won't work for live coding together.

This plugin for Neovim: Instant allows multiple clients coding together in Neovim each one with its own cursor, but it only shares text.

Is there a way for Tmux to share only the vim commands, native or from plugins, and not text? If so, one could use both Tmux and Instant and have the best of both worlds.

I'm using Ubuntu Studio 22.04, NeoVim v0.8.0-dev-1081-g907fc8ac3, tmux (I couldn't find which version), scnvim and tidal-vim for livecoding.

Thank you all in advance for any directions.


--

Mikkel Munch Mortensen

unread,
Nov 28, 2022, 10:48:00 AM11/28/22
to tmux-...@googlegroups.com
Hi Gil Fuser

That's a really interesting idea you have there, collaboratively live
coding music. Can we follow that project somewhere?

And then on to your question...


Maybe I've misunderstood what you actually want to do. But my first
thought is: Do you need tmux at all? At its core, and if I understand
how Instant works correctly, each user can sit with their own computer
and only need Vim and Instant installed. Here are the steps that need to
be taken per participant (P):

P1: Start Vim -> Start an Instant server in Vim.
P2+: Start Vim -> Connect to the Instant server on the computer of P1.


Now, that requires that all computers are networked in a way where the
server port of P1 is exposed to the rest of the participants. If you're
on the same (W)LAN, you don't need more than that. But you might not be
sitting together physically and exposing the Instant server port from
the computer of P1 might not be ideal, at least from a security
perspective. In that case, I would add SSH to the mix -- but you still
don't need tmux.

P1: SSH into a shared computer > Start Vim -> Start an Instant server in
Vim.
P2+: SSH into the same shared computer (or another computer on the same
network) -> Start Vim -> Connect to the Instant server on the computer
of P1.

In that case, all you need (apart from Vim and Instant) is a server that
is online and set up in a way allowing you and your co-creators to SSH
into it. You can even use the same user account on the machine if you
need. But you will each have your own user session going.


You might still want to add tmux to the mix as well, though. In that
case:

P1: SSH into a shared computer > Start a tmux session -> Start Vim ->
Start an Instant server in Vim.
P2+: SSH into the same shared computer -> Start *another* tmux session
-> Start Vim -> Connect to the Instant server on the computer of P1.

But, as I see it, this should only be in order to allow each user to
detach and reconnect to their live coding session. They still all need
each have their own tmux session. Sharing the same tmux session does not
make sense to me in your case. Another upside of having a tmux session
each is all the usual benefits of tmux :)

--

Mikkel
> --
> You received this message because you are subscribed to the Google
> Groups "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/tmux-users/CALCsMUZXujmnYSj_S_8U_ATJE2w0Ycgotx6r%3DsBimpOkGC%3D%2Bpg%40mail.gmail.com.

Scott Rochford

unread,
Nov 30, 2022, 8:50:40 AM11/30/22
to Mikkel Munch Mortensen, tmux-...@googlegroups.com
Have you tried a terminal sharing tool such as 'kibitz' or 'tmate' or 'teleconsole'?

Gil Fuser

unread,
Dec 4, 2022, 11:26:42 PM12/4/22
to tmux-...@googlegroups.com
Hi Scott, Philip and Mikkel. I hope you are doing fine.

Thank you all for your responses.
Sorry I took so long to reply. I'm going to do it in reverse order.

Scott, no, I haven't triedTeleconsole nor Kibitz. How do you think they could solve the problem?

Philip, it's not that I'm making music with Vim text, I'm making it with SuperCollider and/or Tidal Cycles in (neo)Vim, using this two plugins respectively: scnvim or the tmuxed version scnvim-tmux and vim-tidal
You can see and hear me doing this here (most recent and first time I did it with a peer), here, here and there
One last thing for you Philip is: livecoding music might be for you and you don't need to win the lottery. Try Tidal. It's easy and fun.

Thank you Mikkel for the thorough reply. Your examples are correct, but that's something that is key to understanding the problem: all participants should be able to start and interact with sclang of their own and from the other participants, through the scnvim plugin.

sclang is one of the three major parts of SuperCollider. Which are:
scsynth – A real-time audio server
sclang – An interpreted programming language
scide  neovim (scnvim) – An editor for sclang with an integrated help system

I've found a thread in the SuperCollider forum similar to what we are discussing here, mentioning. Actually put it in a more educated way than I did here and explain what's the role of tmux in the mix.


Scott Rochford

unread,
Dec 5, 2022, 7:36:19 PM12/5/22
to Gil Fuser, tmux-...@googlegroups.com
>  Scott, no, I haven't triedTeleconsole nor Kibitz. How do you think they could solve the problem?

It sounds like a fairly complex ecosystem you're working in, so I'm not sure how useful my suggestion is.  But at a superficial level it seemed like you just wanted to share a terminal so that multiple people could see and manipulate it, which is what tools like kibitz (the only one that I've personally used) allow.  However I don't think they would allow multiple cursors for simultaneous editing like you use in that first video, so probably not suitable for your use-case.

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.

Nicholas Marriott

unread,
Dec 5, 2022, 8:49:33 PM12/5/22
to Gil Fuser, tmux-users
Multiple people can have different active panes if you attach tmux with -factive-pane



--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.

Gil Fuser

unread,
Dec 13, 2022, 12:30:55 PM12/13/22
to tmux-...@googlegroups.com
Hi everyone.

Just as a follow-up and future reference, since the solution I found has nothing to do with Tmux, although it could have some of its features if it was in the mix.

I put instant.nvim and HyperDisCo together and so I could do what I wanted to.

Thank you all that tried to to help me here. I felt very welcome. It makes me feel like learning more about Tmux

best regards,
Gil
--
Reply all
Reply to author
Forward
0 new messages