In Tmux, how do I assign a particular program to a particular window, so that all calls to that program from a shell in another window in Tmux will go to that program? One example would be a window that just keeps Vim open.

So in this example, whenever I type vim myfile.txt in my shell window in Tmux, I will see myfile.txt in the vim window of Tmux.


There's no universal way to do this, since each program handles this differently, but vim has a client-server mode that might satisfy your needs in this particular instance.

Firstly, start vim in server mode:

vim --servername foo

Now you can open files in that instance of vim from elsewhere:

vim --servername foo --remote-tab file

This requires having a vim version compiled with +clientserver. On Debian, the vim-gnome package contains a version of vim with client-server functionality. Some other distributions have similar packages.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.