I'm usually running one tmux session for all the work I do, with per-project tmux windows (tabs). Each tmux window has one big split running vim and one or more splits with shells/processes related to the project. E.g. for a django project, one shell always runs manage.py runserver
, showing me logs and errors, and another is for moving files around, creating folders, copying stuff etc.
I often find myself typing "vim somefile.py" in that work shell split, spawning another (very small) instance of vim. What I would like to achieve is having that vim command open a buffer with the specified file in the already opened vim instance. I know it's possible with vim's remote feature, but I wonder if there's a way to automate this, i.e. wrap the vim command to autodetect if there's an instance running in the same tmux window and then send the remote command, or spawn the vim instance if none is running.
I would not want is to have the vim command send a remote command to a vim instance in another tmux window, as that would be another project. Is there anything available already (vim or tmux plugin, wrapper script, ...)?