Various fixes

This commit is contained in:
Daniel Flanagan 2020-04-21 16:38:58 -05:00
parent 151a649d94
commit d7af5e1d46
Signed by: lytedev
GPG Key ID: 5B2020A0F9921EF4
9 changed files with 55 additions and 30 deletions

View File

@ -260,4 +260,8 @@ super + Escape
pkill -USR1 -x sxhkd
super + ctrl + c
bspc rule -a '*' -o state=floating && urxvt --geometry 64x9 -e sh -c "cal -n 3 && bash"
bspc rule -a '*' -o state=floating && kitty -o remember_window_size=no -o initial_window_width=66c -o initial_window_height=10c sh -c "cal -n 3 && printf 'Press [ENTER] to close.' && read"
super + ctrl + p
bspc rule -a '*' -o state=floating && \
kitty -o remember_window_size=no -o initial_window_width=122c -o initial_window_height=40c sh -c "{ env FZFP_PASS_OPTS='' FZFP_HEIGHT=100% fzfp | head -n 1 | sd '\n\$' '' | clip; } &"

View File

@ -59,12 +59,10 @@ if [ "$PWD" = "$HOME" ] || [ "$PWD" = "$NICE_HOME" ]; then
cd "$NICE_HOME" || cd || return
fi
[ -f "$HOME/.fzf.bash" ] && . "$HOME/.fzf.bash"
# if [[ -d "$HOME/.asdf/" ]] && [[ -f "$HOME/.asdf/asdf.sh" ]]; then
# . "$HOME/.asdf/asdf.sh"
# elif [[ -d /opt/asdf-vm/ ]] && [[ -f /opt/asdf-vm/asdf.sh ]]; then
# . "/opt/asdf-vm/asdf.sh"
# fi
if [[ -d "$HOME/.asdf/" ]] && [[ -f "$HOME/.asdf/asdf.sh" ]]; then
. "$HOME/.asdf/asdf.sh"
elif [[ -d /opt/asdf-vm/ ]] && [[ -f /opt/asdf-vm/asdf.sh ]]; then
. "/opt/asdf-vm/asdf.sh"
fi
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# [ -f ~/.fzf.bash ] && source ~/.fzf.bash

View File

@ -192,3 +192,7 @@ function chat
set -l pass (pass config/weechat-passphrase | head -n 1)
env WEECHAT_PASSPHRASE=$pass weechat
end
# grep aliases
alias rg "rg --text"
alias grep "rg"

View File

@ -15,14 +15,28 @@ function preprocess_pwd
end
function fish_prompt
if test $status -eq 0
set_color blue
set last_cmd_status $status
if test (id -u) -eq 0
if test $last_cmd_status -eq 0
set_color -b blue black
else
set_color -b red black
end
printf " SUDO $USER@$hostname"
else
set_color red
if test $last_cmd_status -eq 0
set_color blue
else
set_color red
end
printf "$USER@$hostname"
end
printf $USER"@"$hostname" "
set_color normal
printf " "
set_color magenta
printf (preprocess_pwd)" "
printf (preprocess_pwd)""
set_color normal
printf " "
end
function fish_mode_prompt; end

View File

@ -97,7 +97,7 @@ bind-key u capture-pane \;\
is_vim="ps -o state= -o comm= -t \"#{pane_tty}\" \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -Tcopy-mode-vi "C-h" send -X "cancel select-pane -L"
bind-key -T copy-mode-vi "C-h" send -X "cancel select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
@ -105,7 +105,8 @@ bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# YANKING
bind-key -Tcopy-mode-vi "y" send -X copy-selection
# bind-key -T copy-mode-vi "y" send -X copy-selection
bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel -X 'clip'
set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.config/tmux/plugins/"

View File

@ -1,10 +1,11 @@
#!/usr/bin/env sh
# TODO: detect MIME type?
# can a `clip-once` script exist building on this?
# wl-copy `-o`, xclip `-l 1`?
if is_wayland; then
# echo "Clip: YES. THIS IS WAYLAND SPEAKING." >&2
sed 's/^\s+//g' | sed 's/\s+$//g' | wl-copy "$@"
echo "Your trimmed input was stored in all clipboards."
wl-copy -n wl-copy --trim-newline "$@"
else
xclip -selection clipboard
sleep 5 && killall xclip > /dev/null 2>&1 &
xclip -i -sel p -f "$@" | xclip -i -sel c "$@"
fi

View File

@ -1,8 +1,13 @@
#!/usr/bin/env sh
op="${1:--c}"; shift >&2 2>/dev/null
cd ~/.password-store || { echo "Could not cd to ~/.password-store"; exit 1; }
pp="$(fd gpg | sd ".gpg" "" | fzf --height 40%)"
echo "pass $op $pp"
pass "$op" "$@" "$pp"
cd - || return 1
FZFP_PASS_CMD="pass"
FZFP_PASS_DIR="$HOME/.password-store"
FZFP_HEIGHT="${FZFP_HEIGHT:-40%}"
FZFP_PROMPT="${FZFP_PROMPT:-"$FZFP_PASS_CMD@$FZFP_PASS_DIR> "}"
FZFP_PASS_OPTS="${FZFP_PASS_OPTS:-}"
cd "$FZFP_PASS_DIR" || { echo "Could not cd to $FZFP_PASS_DIR" >&2; exit 1; }
pp="$(fd gpg | sd ".gpg" "" | fzf --height "$FZFP_HEIGHT" --prompt "$FZFP_PROMPT")"
"${FZFP_PASS_CMD}" $FZFP_PASS_OPTS "$@" "$pp"
cd - >/dev/null || return 1

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
test "$IS_WAYLAND" == "1" || test -n "$WAYLAND_DISPLAY" || test -n "$SWAYSOCK" || test -z "$DISPLAY"
loginctl show-session "$(loginctl | grep $(whoami) | field 1)" -p Type | grep -i wayland >/dev/null

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -xe
f="$1"; shift
[ -f "$f" ] && source "$f" "$@"
true