From 642e439ddac3c27431616778925f26d37e3db0fb Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 26 Sep 2024 12:30:31 +0200 Subject: checkpoint --- config/essentials/shell/functions.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'config/essentials/shell') diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 2a21655..7dd14cf 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -344,9 +344,9 @@ nvim_bindings() { "$(tmp="$(mktemp)"; nvim +":set nomore | :redir! > $tmp | :ma prj () { pfx="$HOME/proj" - d="$(find "$pfx" -mindepth 1 -maxdepth 1 -type d | sed "s@$pfx@@" |fzf)" - [ -d "$d" ] || exit 1 - cd "$pfx"/"$d" + d="$(find "$pfx" -mindepth 1 -maxdepth 1 -type d | sed "s@$pfx/@@" |fzf)" + [ -d "$pfx/$d" ] || return 1 + cd "$pfx/$d" } edit_git_file () { @@ -355,3 +355,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 $@ +} -- cgit v1.2.3