zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
19.42k stars 611 forks source link

dynamic per-subfolder tabs/panes #3380

Open feakuru opened 1 month ago

feakuru commented 1 month ago

I apologize if this is already described in the docs and I missed it, but basically what I want is to be able to define a tab template, and then run zellij in a directory in such a way that it opens one tab of that template per a subdirectory of that directory. Currently, I am using tmux+tmuxinator for this, and there it's possible with minimal Ruby knowledge since they use ERB templates, like this:

windows:
  <% Dir["/folder/with/my/subprojects/*"].each do |file| %>
  <% if Pathname.new(file).directory? %>
  - <%= File.basename(file) %>:
      root: <%= file %>
      layout: d4f6,245x40,0,0{81x40,0,0,0,163x40,82,0,1}
      <% if File.exists?(File.join(file, "pyproject.toml"))%>
      panes:
        - poetry shell
        - poetry run nvim
      <% else %>
      panes:
        - zsh
        - nvim
      <% end %>
  <% end %>
  <% end %>

so when i open this layout, i get a tab per subfolder, and each tab has a terminal and a nvim instance. is something like this possible in zellij?

giyany commented 1 month ago

Hi there, do you know about zellij layouts?

A tutorial: https://zellij.dev/tutorials/layouts/

There is more information in the docs. For specific configuration, the zellij Discord and Matrix are good places to find help.

feakuru commented 1 month ago

thanks! i do know about zellij layouts, my question is whether i can somehow implement a dynamuc cycle over subfolders in a folder in a layout. reading through zellij docs and KDL format specification, i didn't find a way to do this other than to manually specify each folder name