Add fmt function, add ssh-agent

This commit is contained in:
buffet 2022-05-23 11:37:09 +00:00
parent 7bdeaae78c
commit d61996c98c

View file

@ -20,6 +20,18 @@ t() {
esac esac
} }
fmt() {
[ -f .clang-format ] && {
find src -type f -name '*.[ch]' -print | xargs -d '\n' clang-format -i
return
}
[ -f Cargo.toml ] && {
cargo fmt
return
}
}
__prompt() { __prompt() {
case $? in case $? in
0) PS1='\[\e[34m\]' ;; 0) PS1='\[\e[34m\]' ;;
@ -40,3 +52,8 @@ PROMPT_COMMAND="__prompt;$PROMPT_COMMAND"
. "$HOME/.cargo/env" . "$HOME/.cargo/env"
eval "$(direnv hook bash)" eval "$(direnv hook bash)"
pgrep -u "$USER" -x ssh-agent >/dev/null || ssh-agent -t 5m >"$XDG_RUNTIME_DIR/ssh-agent.env"
[[ "$SSH_AUTH_SOCK" ]] || . "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
head -n 10 ~/todo/todo