diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-26 12:30:31 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-26 12:30:31 +0200 |
commit | 642e439ddac3c27431616778925f26d37e3db0fb (patch) | |
tree | 6c0db2ed38418728766008a6a3b49bef51740b71 /config/essentials/shell/functions.sh | |
parent | 490beb2bfe184a96c92b831219569d6e89ade8ef (diff) |
checkpoint
Diffstat (limited to 'config/essentials/shell/functions.sh')
-rw-r--r-- | config/essentials/shell/functions.sh | 20 |
1 files changed, 17 insertions, 3 deletions
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 $@ +} |