Merge branch 'script-tweaks' into 'main'

Added some minor twekas to workspace scripts + new git tmux shortcut.

See merge request sagidayan/linux-config!12
This commit is contained in:
Sagi Dayan 2022-01-24 10:07:45 +00:00
commit 2d20980022
4 changed files with 14 additions and 13 deletions

View file

@ -30,6 +30,7 @@
ada = add . ada = add .
cm = commit -m cm = commit -m
ck = checkout ck = checkout
fza = "!git ls-files -m -o --exclude-standard | fzf -m --print0 --reverse --header \"🞥 Select files to stage. use [tab] for multi selection\" --preview \"bat --diff --color=always --style=numbers,changes,grid {}\" | xargs -0 -t -o git add"
[diff] [diff]
tool = vimdiff tool = vimdiff

View file

@ -5,13 +5,11 @@ JSON_PATH=~/.shellconfig/workspaces/workspaces.json
function yes_no_question() { function yes_no_question() {
QUESTION=$1 QUESTION=$1
RESPONSE=$(cat <<EOF | fzf --reverse --header "${QUESTION}" RESPONSE=$(cat <<EOF | fzf --reverse --header "${QUESTION}"
No No
Yes 🗸 Yes
EOF EOF
) )
echo $(echo $RESPONSE | awk '{print $2}')
echo $RESPONSE
} }
NAME=${1:-} NAME=${1:-}

View file

@ -5,12 +5,11 @@ JSON_PATH=~/.shellconfig/workspaces/workspaces.json
function yes_no_question() { function yes_no_question() {
QUESTION=$1 QUESTION=$1
RESPONSE=$(cat <<EOF | fzf --reverse --header "${QUESTION}" RESPONSE=$(cat <<EOF | fzf --reverse --header "${QUESTION}"
No No
Yes 🗸 Yes
EOF EOF
) )
echo $(echo $RESPONSE | awk '{print $2}')
echo $RESPONSE
} }
WSP=$(cat ${JSON_PATH} \ WSP=$(cat ${JSON_PATH} \
@ -18,12 +17,12 @@ WSP=$(cat ${JSON_PATH} \
| fzf --reverse --header "Select a Workspace to DELETE" | fzf --reverse --header "Select a Workspace to DELETE"
) )
if [ -z $WSP ]; then if [ -z "$WSP" ]; then
echo "Aborted" echo "Aborted"
exit 1 exit 1
fi fi
RESPONSE=$(yes_no_question "❓ Are you sure you want to delete ${WSP}?") RESPONSE="$(yes_no_question "❓ Are you sure you want to delete ${WSP}?")"
if [ "$RESPONSE" == "No" ]; then if [ "$RESPONSE" == "No" ]; then
echo "Aborted" echo "Aborted"

View file

@ -49,6 +49,9 @@ bind-key x run-shell "tmux neww -n '🖥Workspace Manager' ~/.shellconfig/worksp
# Change git branches fast <prefix>-b # Change git branches fast <prefix>-b
bind-key b send-keys "gitB" C-m bind-key b send-keys "gitB" C-m
# Git add + fzf
bind-key g run-shell "tmux neww -n '🞥 📑 Git Add' 'cd #{pane_current_path} && (git ls-files -m -o --exclude-standard | fzf -m --print0 --reverse --header \"🞥 Select files to stage. use [tab] for multi selection\" --preview \"bat --diff --color=always --style=numbers,changes,grid {}\" | xargs -0 -o -t git add)'"
############################ ############################
# Themes # Themes
########################### ###########################