vimtmuxtmuxinator

Creating a generic command to edit and quickly execute (python) scripts


I am currently using tmux to create two panes and have vim open in one and plain terminal on the other.

I am using tmuxinator to automate the proccess but I can't figure out a way to make it more generic for different files in different project.

Here is my project.yml for tmuxinator

windows:
  - editor:
      layout: 9a26,204x53,0,0{115x53,0,0,0,88x53,116,0,1}
      panes:
        - editor:
            - workon dev
            - vim ~/repos/project/ #somehow specify this file through arguements
        - commandline:
            - workon dev

and here is the vim map I use to execute the current file to the pane on the right

:map <Leader>rl :w<Bar>execute 'silent !tmux send-keys -t right "python $(pwd)/%" ENTER'<Bar>redraw!<C-M>

I was wondering if there is a way to give an arguement to the tmuxinator project command or something of this sort for the file that vim is going to open.

Kind of an alias that I could type tmux-alias-for-vim-and-python dev-file.py without having to create a project.yml for each and every different project/file I want to work on.

I may be following an incorrect approach to using tmux/tmuxinator this way so I am open to other suggestion that could accomplish the same thing without tmuxinator


Solution

  • There is no existing trivial way to achieve this.

    tmux/tmuxinator aren't really set up to work this way. The best way I can think to have something like this would be to have a template tmuxinator file and set up a shell script so that the script

    1. Takes the arguments you need to pass to the template
    2. Uses those arguments to create a new tmuxinator file
    3. Launches tmuxinator using the new file name as the argument

    Once you've done that, put the project up on GitHub. I'm sure there are plenty of people who'd like to have something like this.