diff options
Diffstat (limited to 'config/essentials/shell')
-rw-r--r-- | config/essentials/shell/functions.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index d18a188..1413fd8 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -350,7 +350,7 @@ nvim_bindings() { prj () { pfx="$HOME/proj" d="$(find "$pfx" -mindepth 1 -maxdepth 1 -type d | sed "s@$pfx/@@" |fzf)" - [ -d "$pfx/$d" ] || exit 1 + [ -d "$pfx/$d" ] || return 1 cd "$pfx/$d" } @@ -360,3 +360,17 @@ edit_git_file () { [ "$f" ] || return 2 $EDITOR "$1"/"$f" } + +# Wrapper to automatically add the key +# could have been alias='SSH_ASKPASS=askpass SSH_ASKPASS_REQUIRE=prefer ssh' +# but this option is very slow for some reason +ssh() { + for arg in $@; do + if grep "Host $arg\s*\$" ~/.ssh/config > /dev/null 2>&1 ; + then + keyadd "$arg" 2> /dev/null + break + fi + done + /usr/bin/ssh $@ +} |