From 40c79488d4f6b77e4f72441f8a7dc0d924f03fcc Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 25 Dec 2019 21:27:17 -0500 Subject: [PATCH] Migrate from antigen back to zim --- .profile | 35 ++++++++++--------- .zimrc | 25 ++++++++++++++ .zlogin | 7 ++++ .zshenv | 14 +++++--- .zshrc | 102 ++++++++++++++++++++++++++----------------------------- 5 files changed, 109 insertions(+), 74 deletions(-) create mode 100644 .zimrc create mode 100644 .zlogin diff --git a/.profile b/.profile index 637612f..07136b8 100644 --- a/.profile +++ b/.profile @@ -3,20 +3,23 @@ source $HOME/.zshenv # Gnupg setup -## Start the gpg-agent if not already running -if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then - gpg-connect-agent /bye >/dev/null 2>&1 +if hash gpg-agent 2>/dev/null +then + # Start the gpg-agent if not already running + if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then + gpg-connect-agent /bye >/dev/null 2>&1 + fi + + # Set SSH to use gpg-agent + unset SSH_AGENT_PID + if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" + fi + + # Set GPG TTY + GPG_TTY=$(tty) + export GPG_TTY + + # Refresh gpg-agent tty in case user switches into an X session + gpg-connect-agent updatestartuptty /bye >/dev/null fi - -## Set SSH to use gpg-agent -unset SSH_AGENT_PID -if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then - export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" -fi - -## Set GPG TTY -GPG_TTY=$(tty) -export GPG_TTY - -## Refresh gpg-agent tty in case user switches into an X session -gpg-connect-agent updatestartuptty /bye >/dev/null diff --git a/.zimrc b/.zimrc new file mode 100644 index 0000000..45ac343 --- /dev/null +++ b/.zimrc @@ -0,0 +1,25 @@ +# -*- mode: sh; -*- + +# +# Modules +# + +zmodule environment +zmodule git +zmodule input +zmodule fasd +zmodule termtitle +zmodule utility + +# Prompt +zmodule git-info +zmodule https://adamgoldsmith.name/cgit/zsh/fred-prompt.git + +zmodule zsh-users/zsh-completions +# completion must be sourced after zsh-users/zsh-completions +zmodule completion +zmodule zsh-users/zsh-autosuggestions +# zsh-users/zsh-syntax-highlighting must be sourced after completion +zmodule zsh-users/zsh-syntax-highlighting +# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting +zmodule zsh-users/zsh-history-substring-search diff --git a/.zlogin b/.zlogin new file mode 100644 index 0000000..c7c5f05 --- /dev/null +++ b/.zlogin @@ -0,0 +1,7 @@ +# +# User configuration sourced by login shells +# + +# Initialize Zim +source ${ZIM_HOME}/login_init.zsh -q &! + diff --git a/.zshenv b/.zshenv index 539c81b..b7ca723 100644 --- a/.zshenv +++ b/.zshenv @@ -1,20 +1,24 @@ #-*- mode: sh; -*- +# Define Zim location +ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim + # Environment variables export EDITOR="emacsclient -t" +export ALTERNATE_EDITOR="" export VISUAL="emacsclient -c -n" +export PAGER=less +export TERMINAL=alacritty + export ARDUINO_DIR="/usr/share/arduino" export ARDMK_DIR="$HOME/Programs/Arduino-Makefile" export STEAMAPPS="$HOME/.local/share/Steam/steamapps/common" + export QT_STYLE_OVERRIDE=gtk2 export QT_AUTO_SCREEN_SCALE_FACTOR=true -export ALTERNATE_EDITOR="" -export TERMINAL=xfce4-terminal export CALIBRE_USE_SYSTEM_THEME=true -export WINEDLLOVERRIDES=winemenubuilder.exe=d -export WORDCHARS=${WORDCHARS/\//} -export PAGER=less +export WINEDLLOVERRIDES=winemenubuilder.exe=d # Add $HOME/.bin to PATH if it exists and is not already in the path if [[ -d "$HOME/.bin" ]] && ! grep -q ":$HOME"'/\.bin\(:\|$\)' <<< "$PATH" diff --git a/.zshrc b/.zshrc index ac276ef..38d6fa4 100644 --- a/.zshrc +++ b/.zshrc @@ -1,70 +1,59 @@ -# Antigen Stuff -ADOTDIR="$HOME/.antigen" -[ ! -e "$ADOTDIR" ] && git clone https://github.com/zsh-users/antigen.git "$ADOTDIR" -source "$ADOTDIR/antigen.zsh" +if [ ! -d "$HOME/.zim" ] +then + git clone https://github.com/zimfw/zimfw $HOME/.zim -b develop + source ~/.zim/zimfw.zsh install +fi -# Temporary, hopefully remove later when antigen correctly fails to shallow clone from http -[ ! -e "$ADOTDIR/bundles/zsh/fred-prompt" ] && git clone https://adamgoldsmith.name/cgit/zsh/fred-prompt.git/ $ADOTDIR/bundles/zsh/fred-prompt +# Remove older command from the history if a duplicate is to be added. +setopt HIST_IGNORE_ALL_DUPS +unsetopt SHARE_HISTORY +setopt INC_APPEND_HISTORY -antigen bundles </dev/null && eval "$(fasd --init auto)" - -# Load run-help -unalias run-help -autoload run-help - -# Auto start tmux if a remote connection -if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -n "$SSH_TTY" ]] -then - # Attach only to the 'auto' session - exec tmux new-session -A -s 'auto' -fi - - # History Substring Search bindings (PageUp and PageDown) bindkey '^[[5~' history-substring-search-up bindkey '^[[6~' history-substring-search-down -# Expands ... to ../.. -function expand-dot-to-parent-directory-path { - if [[ $LBUFFER = *.. ]]; then - LBUFFER+='/..' - else - LBUFFER+='.' - fi -} -zle -N expand-dot-to-parent-directory-path -bindkey -M emacs "." expand-dot-to-parent-directory-path -bindkey -M isearch "." self-insert - # Inserts 'sudo ' at the beginning of the line. function prepend-sudo() { if [[ "$BUFFER" != su(do|)\ * ]]; then @@ -78,3 +67,10 @@ bindkey "^X^S" prepend-sudo # Control-Backspace and Control-Delete bindkey '^H' backward-kill-word bindkey '5~' kill-word + +# Auto start tmux if a remote connection +if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -n "$SSH_TTY" ]] +then + # Attach only to the 'auto' session + exec tmux new-session -A -s 'auto' +fi