From 1b2f75ca475083d345a520c8b1dd5fcbcc8aac39 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Thu, 26 Sep 2019 23:43:31 -0700 Subject: [PATCH] Reduce prezto deps. --- dotfiles/zpreztorc | 7 +-- dotfiles/zshrc | 13 +++--- .../functions => zshrc.completions}/_docker | 0 .../functions => zshrc.completions}/_jekyll | 0 .../_msfconsole | 0 .../functions => zshrc.completions}/_msfvenom | 0 .../functions => zshrc.completions}/_virsh | 0 dotfiles/zshrc.d/gpg.zsh | 44 +++++++++++++++++++ .../jekyll/init.zsh => zshrc.d/jekyll.zsh} | 0 dotfiles/zshrc.d/source_gnupg.zsh | 6 --- 10 files changed, 51 insertions(+), 19 deletions(-) rename dotfiles/{zprezto_custom/xtra_completions/functions => zshrc.completions}/_docker (100%) rename dotfiles/{zprezto_custom/jekyll/functions => zshrc.completions}/_jekyll (100%) rename dotfiles/{zprezto_custom/xtra_completions/functions => zshrc.completions}/_msfconsole (100%) rename dotfiles/{zprezto_custom/xtra_completions/functions => zshrc.completions}/_msfvenom (100%) rename dotfiles/{zprezto_custom/xtra_completions/functions => zshrc.completions}/_virsh (100%) create mode 100644 dotfiles/zshrc.d/gpg.zsh rename dotfiles/{zprezto_custom/jekyll/init.zsh => zshrc.d/jekyll.zsh} (100%) delete mode 100644 dotfiles/zshrc.d/source_gnupg.zsh diff --git a/dotfiles/zpreztorc b/dotfiles/zpreztorc index 0babb44..c13d6a7 100644 --- a/dotfiles/zpreztorc +++ b/dotfiles/zpreztorc @@ -32,19 +32,14 @@ zstyle ':prezto:load' pmodule \ 'editor' \ 'history' \ 'directory' \ - 'spectrum' \ 'completion' \ 'matir' \ 'tmux' \ 'git' \ - 'gpg' \ 'python' \ - 'ruby' \ 'syntax-highlighting' \ 'history-substring-search' \ - 'jekyll' \ - 'prompt' \ - 'xtra_completions' + 'prompt' # # Autosuggestions diff --git a/dotfiles/zshrc b/dotfiles/zshrc index a25dacb..c24c6fe 100755 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -9,11 +9,6 @@ bindkey -v # Allow core files ulimit -c unlimited -# Completion -zstyle :compinstall filename "${HOME}/.zshrc" -zstyle ':completion:*' users root ${USER} -autoload -Uz compinit && compinit - DIRSTACKSIZE=16 case $TERM in xterm*) @@ -40,7 +35,6 @@ unsetopt cdablevars # Deduplicate the path typeset -U path - # Keybindings bindkey '^[[A' history-search-backward bindkey '^[[B' history-search-forward @@ -55,12 +49,17 @@ bindkey '^h' backward-delete-char bindkey '^w' backward-kill-word bindkey '^r' history-incremental-search-backward - # Source extras and aliases if interactive if [[ $- == *i* ]] ; then if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi # zsh-only-ism to avoid error if glob doesn't expand for file in $HOME/.zshrc.d/*(N) ; do source "$file" ; done + # extra completions + fpath=(~/.zshrc.completions $fpath) + # Completion + zstyle :compinstall filename "${HOME}/.zshrc" + zstyle ':completion:*' users root ${USER} + autoload -Uz compinit && compinit fi # In case ack is named ack-grep diff --git a/dotfiles/zprezto_custom/xtra_completions/functions/_docker b/dotfiles/zshrc.completions/_docker similarity index 100% rename from dotfiles/zprezto_custom/xtra_completions/functions/_docker rename to dotfiles/zshrc.completions/_docker diff --git a/dotfiles/zprezto_custom/jekyll/functions/_jekyll b/dotfiles/zshrc.completions/_jekyll similarity index 100% rename from dotfiles/zprezto_custom/jekyll/functions/_jekyll rename to dotfiles/zshrc.completions/_jekyll diff --git a/dotfiles/zprezto_custom/xtra_completions/functions/_msfconsole b/dotfiles/zshrc.completions/_msfconsole similarity index 100% rename from dotfiles/zprezto_custom/xtra_completions/functions/_msfconsole rename to dotfiles/zshrc.completions/_msfconsole diff --git a/dotfiles/zprezto_custom/xtra_completions/functions/_msfvenom b/dotfiles/zshrc.completions/_msfvenom similarity index 100% rename from dotfiles/zprezto_custom/xtra_completions/functions/_msfvenom rename to dotfiles/zshrc.completions/_msfvenom diff --git a/dotfiles/zprezto_custom/xtra_completions/functions/_virsh b/dotfiles/zshrc.completions/_virsh similarity index 100% rename from dotfiles/zprezto_custom/xtra_completions/functions/_virsh rename to dotfiles/zshrc.completions/_virsh diff --git a/dotfiles/zshrc.d/gpg.zsh b/dotfiles/zshrc.d/gpg.zsh new file mode 100644 index 0000000..518abe2 --- /dev/null +++ b/dotfiles/zshrc.d/gpg.zsh @@ -0,0 +1,44 @@ +if ! which gpg-agent >/dev/null 2>&1 ; then + return 1 +fi + +# Set the default paths to gpg-agent files. +_gpg_agent_conf="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.conf" +_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env.$UID" + +# Load environment variables from previous run +source "$_gpg_agent_env" 2> /dev/null + +# Start gpg-agent if not started. +if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then + # Start gpg-agent if not started. + if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then + eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")" + fi +fi + +# Inform gpg-agent of the current TTY for user prompts. +export GPG_TTY="$(tty)" + +# Integrate with the SSH module. +if grep '^enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then + # Load required functions. + autoload -Uz add-zsh-hook + + # Override the ssh-agent environment file default path. + _ssh_agent_env="$_gpg_agent_env" + + # Updates the GPG-Agent TTY before every command since SSH does not set it. + function _gpg-agent-update-tty { + gpg-connect-agent UPDATESTARTUPTTY /bye >/dev/null + } + add-zsh-hook preexec _gpg-agent-update-tty +fi + +# Clean up. +unset _gpg_agent_{conf,env} + +# Disable GUI prompts inside SSH. +if [[ -n "$SSH_CONNECTION" ]]; then + export PINENTRY_USER_DATA='USE_CURSES=1' +fi diff --git a/dotfiles/zprezto_custom/jekyll/init.zsh b/dotfiles/zshrc.d/jekyll.zsh similarity index 100% rename from dotfiles/zprezto_custom/jekyll/init.zsh rename to dotfiles/zshrc.d/jekyll.zsh diff --git a/dotfiles/zshrc.d/source_gnupg.zsh b/dotfiles/zshrc.d/source_gnupg.zsh deleted file mode 100644 index 8a48317..0000000 --- a/dotfiles/zshrc.d/source_gnupg.zsh +++ /dev/null @@ -1,6 +0,0 @@ -function source_gnupg { - GPG_ENV=${HOME}/.gnupg/gpg-agent.env - if test -f ${GPG_ENV} ; then - eval $(sed 's/^/export /' ${GPG_ENV}) - fi -}