How to open all folders in CWD as tmux windows

17 Views Asked by At

I would like to find out how to open all folders in CWD as tmux windows. Imagine you are in the terminal and you have folders

ls -al 
folder1
folder2
folder3
...

I would like to achieve that ech folder would be TMUX window (folder1, ..., folder3). Each window would be splitted horizontally in some ration 70:30.

Ideally when hitting prefix + w - there would be an option to fuzzy search it automatically.

When it comes to FZF I crafted something like this - however, it does not work with bind-key

bind-key / run-shell 'tmux select-window -t  $(tmux list-windows -F "#{window_id}" | fzf)'

First part of my question can be solved like this

cd ~/Documents/work
tmux new-session -s "mac" -n work -d
for i in  $(ls -d */ | nl -s:); do 
  tmux new-window -t "mac:${i%:*}" -n "${i##*:}" -c ${i##*:};
  tmux split-window -t "mac:${i%:*}" -v -c "#{pane_current_path}" -l '20%';
done

Any Ideas ?

0

There are 0 best solutions below