[tmux] Add git diff switching staged to dot session

The git log display will now depend on current staged status.

If no files have been staged, the panel will display recent git logs
with branches and short titles, as before.

If files have been staged however, the panel will switch to display
staged changes however. This is to facilitate a better overview of
changes during the staging and committing process; since often one wants
to see the staged changes next to the commit that is being written.
This commit is contained in:
Marty Oehme 2020-05-28 10:37:56 +02:00
parent 11a6eda0ce
commit 7895b1c052
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A

View file

@ -4,7 +4,7 @@ split-window -h watch -t -n 1 -c 'cd ~/.dotfiles; git -c color.ui=always status
split-window -v
send-keys "cd ~/.dotfiles; clear" C-m L C-m
select-pane -t 1
split-window -v watch -t -n 1 -c 'cd ~/.dotfiles; git -c color.ui=always log --graph --date=short --decorate --oneline --all --remotes'
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
new-window -n code
send-keys "cd ~/.dotfiles; v ." C-m I