From d9fad010143297224534f0ae02a6d75d814465c7 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Thu, 10 Jul 2025 22:51:26 +0200 Subject: add systemd user service for ssh agent and zshrc --- Makefile | 2 ++ systemd/user/ssh-agent.service | 13 +++++++++++++ zshrc | 44 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 systemd/user/ssh-agent.service create mode 100644 zshrc diff --git a/Makefile b/Makefile index 53fe206..8eac79d 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ install: ${HOME}/.config ${HOME}/bin rsync -r hypr/ ${HOME}/.config/hypr/ + rsync -r systemd/ ${HOME}/.config/systemd/ rsync -r tmux/ ${HOME}/.config/tmux/ rsync -r vim/ ${HOME}/.config/vim/ rsync -a bin/ ${HOME}/bin/ + rsync -r zshrc ${HOME}/.zshrc ${HOME}/bin: mkdir ${HOME}/bin diff --git a/systemd/user/ssh-agent.service b/systemd/user/ssh-agent.service new file mode 100644 index 0000000..ca58d4f --- /dev/null +++ b/systemd/user/ssh-agent.service @@ -0,0 +1,13 @@ +[Unit] +Description=SSH key agent + +[Service] +Type=simple +Environment=SSH_AUTH_SOCK=%t/agent.sock +# DISPLAY required for ssh-askpass to work +Environment=DISPLAY=:0 +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK +RuntimeDirectory=ssh-agent + +[Install] +WantedBy=default.target diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..935339c --- /dev/null +++ b/zshrc @@ -0,0 +1,44 @@ +autoload -Uz compinit +autoload colors ; colors +autoload -U edit-command-line + +compinit + +HISTFILE=~/.histfile +HISTSIZE=900000 +SAVEHIST=200000 +setopt appendhistory nomatch +unsetopt autocd beep extendedglob notify + +# set line editing to vim +zle -N edit-command-line +bindkey -M vicmd v edit-command-line + +PS1="$(print '%{\e[1;30m%}[%{\e[1;31m%}%*%{\e[1;30m%}]%{\e[0m%} %{\e[1;30m%}[%{\e[1;31m%}%n%{\e[1;30m%}-%{\e[1;31m%}%m%{\e[1;30m%}]%{\e[1;31m%} %2d %{\e[0m%}')" + +bindkey -v '^[[3~' delete-char +bindkey -v '^[[4~' end-of-line +bindkey -v '^[OF' end-of-line +bindkey -v '^[[F' end-of-line +bindkey -v '^[[1~' beginning-of-line +bindkey -v '^[[H' beginning-of-line +bindkey -v '^[OH' beginning-of-line +bindkey -v '^[[5~' history-beginning-search-backward +bindkey -v '^[[6~' history-beginning-search-forward +bindkey -v '^K' history-search-backward +bindkey -v '^J' history-search-forward +bindkey -v '^R' history-incremental-search-backward +bindkey -v '^T' history-incremental-search-forward +bindkey -v '^[^?' backward-delete-word + +# environment setup +export EDITOR="vim" +export PAGER="less -FXR" + +# load any SSH keys into the agent +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent/agent.sock" +keys_loaded="$( ssh-add -l | grep 'has no ident' | wc -l )" +if [ "$keys_loaded" -eq "1" ]; then + ssh-add +fi +ssh-add -l -- cgit v1.2.3-70-g09d2