is there a way to dynamically make array list of yaml in tmuxinator?

310 views Asked by At

I would like to use tmuxinator for my work. I have a folder which has several files not more than 6-7 files. I want tmuxinator to be configured such that tmux has a window with splitted panes all of which are assigned to a specific file in the folder.

tmuxinator project goes as follows:

name: case
root: <%= ENV["PWD"] %>
windows:
    setup:
        panes:
            - < this list should change dynamically>

any ideas?

2

There are 2 answers

0
pdoherty926 On

Another, arguably more flexible option, would be to pass the list of files to tmuxinator using CLI args.

For example, you could change your project config file to the following:

name: case
windows:
  - setup:
        panes:
            <%- args.each do |file| %>
              - vim <%= file %>
            <%- end %>

... and then start tmuxinator using: tmuxinator start case $(find . -maxdepth 1 -type f)

0
Seong On

I found that it provides loop block as follows:

<%- `find . -maxdepth 1 -type f`.split("\n").each do |item| %>
- <%= item.chomp %>: vim <%= item %>
<%- end >

Thus, the previous my question would be

name: case
root: <%= ENV["PWD"] %>
windows:
    setup:
        panes:
            <%- `find . -maxdepth 1 -type f`.split("\n").each do |item| %>
            - <%= item.chomp %>: vim <%= item %>
            <%- end >