mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-21 00:55:43 +00:00
chore(scripts): shfmt scripts
This commit is contained in:
@@ -2,8 +2,9 @@
|
|||||||
# fzf-tmux: starts fzf in a tmux pane
|
# fzf-tmux: starts fzf in a tmux pane
|
||||||
# usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
|
# usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
|
||||||
|
|
||||||
fail() {
|
fail()
|
||||||
>&2 echo "$1"
|
{
|
||||||
|
echo >&2 "$1"
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,8 +20,9 @@ term=""
|
|||||||
[[ -n "$LINES" ]] && lines=$LINES || lines=$(tput lines) || lines=$(tmux display-message -p "#{pane_height}")
|
[[ -n "$LINES" ]] && lines=$LINES || lines=$(tput lines) || lines=$(tmux display-message -p "#{pane_height}")
|
||||||
[[ -n "$COLUMNS" ]] && columns=$COLUMNS || columns=$(tput cols) || columns=$(tmux display-message -p "#{pane_width}")
|
[[ -n "$COLUMNS" ]] && columns=$COLUMNS || columns=$(tput cols) || columns=$(tmux display-message -p "#{pane_width}")
|
||||||
|
|
||||||
help() {
|
help()
|
||||||
>&2 echo 'usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
|
{
|
||||||
|
echo >&2 'usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
|
||||||
|
|
||||||
LAYOUT OPTIONS:
|
LAYOUT OPTIONS:
|
||||||
(default layout: -d 50%)
|
(default layout: -d 50%)
|
||||||
@@ -158,7 +160,8 @@ else
|
|||||||
tmux_win_opts=($(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/'))
|
tmux_win_opts=($(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/'))
|
||||||
tmux_off_opts='; set-window-option synchronize-panes off ; set-window-option remain-on-exit off'
|
tmux_off_opts='; set-window-option synchronize-panes off ; set-window-option remain-on-exit off'
|
||||||
fi
|
fi
|
||||||
cleanup() {
|
cleanup()
|
||||||
|
{
|
||||||
\rm -f $argsf $fifo1 $fifo2 $fifo3
|
\rm -f $argsf $fifo1 $fifo2 $fifo3
|
||||||
|
|
||||||
# Restore tmux window options
|
# Restore tmux window options
|
||||||
@@ -236,6 +239,9 @@ fi
|
|||||||
tmux \
|
tmux \
|
||||||
split-window -c "$PWD" $opt "bash -c 'exec -a fzf bash $argsf'" $swap \
|
split-window -c "$PWD" $opt "bash -c 'exec -a fzf bash $argsf'" $swap \
|
||||||
$tmux_off_opts \
|
$tmux_off_opts \
|
||||||
> /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; }
|
> /dev/null 2>&1 || {
|
||||||
|
"$fzf" "${args[@]}"
|
||||||
|
exit $?
|
||||||
|
}
|
||||||
cat $fifo2
|
cat $fifo2
|
||||||
exit "$(cat $fifo3)"
|
exit "$(cat $fifo3)"
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ hr_color="${hr_color:=$CLR_RED}"
|
|||||||
hr_reset="\033[0m"
|
hr_reset="\033[0m"
|
||||||
|
|
||||||
# Prints the HR line
|
# Prints the HR line
|
||||||
hr_draw_char() {
|
hr_draw_char()
|
||||||
|
{
|
||||||
local CHAR="$1"
|
local CHAR="$1"
|
||||||
local LINE=""
|
local LINE=""
|
||||||
LINE=$(printf "%*s" "$((hr_col_count - 3))" " ")
|
LINE=$(printf "%*s" "$((hr_col_count - 3))" " ")
|
||||||
@@ -30,11 +31,11 @@ hr_draw_char() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Passes param and calls hr()
|
# Passes param and calls hr()
|
||||||
hr() {
|
hr()
|
||||||
|
{
|
||||||
for WORD in "${@:--}"; do
|
for WORD in "${@:--}"; do
|
||||||
hr_draw_char "$WORD"
|
hr_draw_char "$WORD"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
hr "$@"
|
hr "$@"
|
||||||
|
|
||||||
|
|||||||
@@ -25,4 +25,3 @@ msg "Installing git-crypt"
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
msg_done "Done installing git-crypt"
|
msg_done "Done installing git-crypt"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user