tmux: Use entr for dot session monitoring

Since I always have entr installed, I can use it to monitor for file
changes and reload the respective git overview panes.

This has the advantage that I can use any interactive displays (e.g.
less) in the respective panes, while still reloading when files actually
change.

I still have to find a way to replicate the switch between git log
and staged changes view whenever files become staged, have not been able
to fix this with entr and it still makes use of the watch command.
This commit is contained in:
Marty Oehme 2021-03-14 17:35:39 +01:00
parent 08c6aee17e
commit a85519e1cb
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -1,12 +1,13 @@
rename-window dot-git rename-window dot-git
send-keys "cd ~/.dotfiles; watch -t -n 1 -c 'git -c color.ui=always diff | tail -n $(($LINES - 2))'" C-m send-keys "cd ~/.dotfiles; fd -t f --hidden | entr -c git -c color.ui=always diff" C-m
split-window -h watch -t -n 1 -c 'cd ~/.dotfiles; git -c color.ui=always status | sed "s/\x1b\[m/\x1b\[00m/"' split-window -h "cd ~/.dotfiles; fd -t f --hidden | entr -c git -c color.ui=always status"
split-window -v split-window -v
send-keys "cd ~/.dotfiles; clear" C-m L C-m send-keys "cd ~/.dotfiles; clear" C-m L C-m
select-pane -t 1 select-pane -t 1
split-window -v watch -t -n 1 -c 'cd ~/.dotfiles; [ $(git diff --staged | wc -l) -eq 0 ] && git -c color.ui=always log --graph --date=short --decorate --oneline --all --remotes || git -c color.ui=always diff --staged | tail -n $(($LINES - 2))' split-window -v watch -t -n 1 -c 'cd ~/.dotfiles; [ $(git diff --staged | wc -l) -eq 0 ] && git -c color.ui=always log --graph --date=short --decorate --oneline --all --remotes || git -c color.ui=always diff --staged | tail -n $(($LINES - 2))'
select-pane -t 4 select-pane -t 4
new-window -n code new-window -n code
send-keys "cd ~/.dotfiles; v ." C-m I send-keys "cd ~/.dotfiles; v ." C-m zo
new-window -n test new-window -n test
select-window -t 1 select-window -t 1
attach-session -t . -c ~/.dotfiles