better ssh
This commit is contained in:
@@ -1,10 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
|
||||||
eval "$(ssh-agent -s)" >/dev/null 2>&1
|
|
||||||
for key in "$HOME/.ssh/keys/"*; do
|
|
||||||
if [ -f "$key" ]; then
|
|
||||||
ssh-add "$key" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
@@ -30,7 +30,7 @@ if type -q fastfetch
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# add 'set -g no_fetch' somewhere in prev.d to disable auto-fetch
|
# add 'set -g no_fetch' somewhere other than post.d to disable fetching
|
||||||
if not set -q no_fetch
|
if not set -q no_fetch
|
||||||
if type -q ff-brief
|
if type -q ff-brief
|
||||||
ff-brief
|
ff-brief
|
||||||
|
|||||||
29
fish/post.d/sshs.fish
Normal file
29
fish/post.d/sshs.fish
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# ssh with encrypted private keys
|
||||||
|
# $ssh_keys should be set in advance or left empty to use default keys
|
||||||
|
if type -q ssh
|
||||||
|
# start ssh agent if not already running
|
||||||
|
if not set -q SSH_AUTH_SOCK
|
||||||
|
if test -f "$HOME/.ssh-agent" -a -r "$HOME/.ssh-agent"
|
||||||
|
bass source "$HOME/.ssh-agent" > /dev/null 2>&1
|
||||||
|
# check if the socket is actually working
|
||||||
|
if not ssh-add -l > /dev/null 2>&1
|
||||||
|
command rm -f "$HOME/.ssh-agent"
|
||||||
|
set -e SSH_AUTH_SOCK
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not set -q SSH_AUTH_SOCK 2>&1
|
||||||
|
command rm -f "$HOME/.ssh-agent"
|
||||||
|
bass eval (ssh-agent -s | tee "$HOME/.ssh-agent") > /dev/null 2>&1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# only need to input passphrase once per session
|
||||||
|
function sshs
|
||||||
|
# test if keys are added to ssh-agent
|
||||||
|
if not ssh-add -l > /dev/null 2>&1
|
||||||
|
ssh-add $ssh_keys
|
||||||
|
end
|
||||||
|
ssh $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -13,6 +13,7 @@ if type -q fzf
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# cd
|
# cd
|
||||||
if type -q zoxide
|
if type -q zoxide
|
||||||
zoxide init fish | source
|
zoxide init fish | source
|
||||||
@@ -47,3 +48,8 @@ if type -q nvim
|
|||||||
set -x EDITOR nvim
|
set -x EDITOR nvim
|
||||||
set -x VISUAL nvim
|
set -x VISUAL nvim
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# others
|
||||||
|
if type -q tty-clock
|
||||||
|
alias clock="tty-clock -c -C 3"
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
|
# PATH
|
||||||
fish_add_path $HOME/.local/bin
|
fish_add_path $HOME/.local/bin
|
||||||
fish_add_path $HOME/.cargo/bin
|
fish_add_path $HOME/.cargo/bin
|
||||||
fish_add_path $HOME/go/bin
|
fish_add_path $HOME/go/bin
|
||||||
fish_add_path $HOME/.scripts
|
fish_add_path $HOME/.scripts
|
||||||
|
|
||||||
|
# man
|
||||||
|
if type -q bat
|
||||||
|
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
||||||
|
set -x MANROFFOPT -c
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user