Skip to content

Commit

Permalink
feat!: switch to zplug
Browse files Browse the repository at this point in the history
  • Loading branch information
henworth committed Feb 25, 2023
1 parent 5082984 commit 5cac8ad
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 196 deletions.
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@
[submodule "tmux/plugins/tmux-prefix-highlight"]
path = tmux/plugins/tmux-prefix-highlight
url = https://github.com/tmux-plugins/tmux-prefix-highlight.git
[submodule "zinit"]
path = zinit
url = https://github.com/zdharma-continuum/zinit.git
ignore = dirty
[submodule "dotbot-template"]
path = dotbot-plugins/dotbot-template
url = https://github.com/ssbanerje/dotbot-template.git
Expand Down Expand Up @@ -158,3 +154,7 @@
[submodule "dotbot-plugins/dotbot-omnipkg"]
path = dotbot-plugins/dotbot-omnipkg
url = https://github.com/code-maniac/dotbot-omnipkg
[submodule "zplug"]
path = zplug
url = https://github.com/zplug/zplug.git
ignore = dirty
2 changes: 1 addition & 1 deletion default.conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
~/.dircolors: nord-dircolors/src/dir_colors
~/.tmux: tmux
~/.vim: vim
~/.zinit: zinit
~/.zplug: zplug
~/.p10k.zsh: p10k.zsh
~/.tmux.conf: tmux.conf
~/.vimrc: vimrc
Expand Down
2 changes: 1 addition & 1 deletion dotbot
Submodule dotbot updated 105 files
12 changes: 6 additions & 6 deletions linux-base.conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# - zsh

- omnipkg:
- install:
- zsh
- install:
- zsh

- sudo:
- shell:
- command: chsh -s /bin/zsh
stdin: true
description: Changing shell to zsh
- shell:
- command: chsh -s /bin/zsh
stdin: true
description: Changing shell to zsh
# - command: bash 1password-gpg-keys.sh 92216B6739F01726EEA30872B0ACD214A1751462
# stdin: true
# description: Install 1password CLI and get gpg keys
Expand Down
14 changes: 14 additions & 0 deletions linux-wsl.conf.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
- plugins:
- dotbot-plugins/dotbot-omnipkg

- omnipkg:
- install:
- socat

- link:
~/.ssh-agent-bridge.sh: ssh-agent-bridge.sh

- shell:
- [
cp windows-terminal-config.json /mnt/c/Users/Mike/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json,
Updating windows terminal settings,
]
- [
unzip -nq =( wget -qO- https://github.com/jstarks/npiperelay/releases/download/v0.1.0/npiperelay_windows_amd64.zip ) -x LICENSE README.md -d ~/bin,
Downloading npiperelay,
]

- template:
- ~/.gnupg/gpg-agent.conf:
Expand Down
19 changes: 19 additions & 0 deletions ssh-agent-bridge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Code extracted from https://dev.to/d4vsanchez/use-1password-ssh-agent-in-wsl-2j6m with minor modifications

# Configure ssh forwarding
export SSH_AUTH_SOCK=${HOME}/.1password/agent.sock

# need `ps -ww` to get non-truncated command for matching
# use square brackets to generate a regex match for the process we want but that doesn't match the grep command running it!
ALREADY_RUNNING=$(ps -auxww | grep -q "[n]piperelay.exe -ei -s //./pipe/openssh-ssh-agent"; echo $?)
if [[ $ALREADY_RUNNING != "0" ]]; then
if [[ -S $SSH_AUTH_SOCK ]]; then
# not expecting the socket to exist as the forwarding command isn't running (http://www.tldp.org/LDP/abs/html/fto.html)
echo "removing previous socket..."
rm $SSH_AUTH_SOCK
fi
echo "Starting SSH-Agent relay..."
# setsid to force new session to keep running
# set socat to listen on $SSH_AUTH_SOCK and forward to npiperelay which then forwards to openssh-ssh-agent on windows
(setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork &) >/dev/null 2>&1
fi
1 change: 1 addition & 0 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ let g:airline_powerline_fonts = 1
set backspace=indent,eol,start

colorscheme nord
set rtp+=/home/linuxbrew/.linuxbrew/opt/fzf
1 change: 0 additions & 1 deletion zinit
Submodule zinit deleted from cbf427
1 change: 1 addition & 0 deletions zplug
Submodule zplug added at 18cfcd
255 changes: 72 additions & 183 deletions zshrc
Original file line number Diff line number Diff line change
@@ -1,166 +1,74 @@
source ${HOME}/.zinit/zinit.zsh

zinit ice depth'1' lucid; zinit light romkatv/powerlevel10k

zturbo(){ zinit depth'1' lucid ${1/#[0-9][a-d]/wait"${1}"} "${@:2}"; }

case "$OSTYPE" in
linux*) bpick='*((#s)|/)*(linux|musl)*((#e)|/)*' ;;
darwin*) bpick='*(macos|darwin)*' ;;
*) echo 'WARN: unsupported system -- some cli programs might not work' ;;
esac

zturbo light-mode for \
zdharma-continuum/zinit-annex-{'submods','patch-dl','bin-gem-node','rust'} \
vladdoster/gitfast-zsh-plugin \
has'brew' as'completion' https://raw.githubusercontent.com/Homebrew/brew/master/completions/zsh/_brew \
has'docker' as'completion' OMZP::docker/_docker \
has'docker-compose' as'completion' OMZP::docker-compose/_docker-compose \
has'go' OMZP::golang as'completion' OMZP::golang/_golang \
has'pip' OMZP::pip as'completion' OMZP::pip/_pip \
has'rsync' PZTM::rsync \
has'terraform' OMZP::terraform as'completion' OMZP::terraform/_terraform \
svn submods'zsh-users/zsh-history-substring-search -> external' \
PZT::modules/history-substring-search \
OMZL::history.zsh \
OMZP::ssh-agent \
PZTM::environment \
PZTM::terminal \
PZTM::spectrum \
PZTM::history \
PZTM::command-not-found \
PZTM::tmux \
PZTM::ruby

# OMZP::pipenv \

zi for \
from'gh-r' as'null' sbin'fzf' junegunn/fzf \
https://github.com/junegunn/fzf/raw/master/shell/{'completion','key-bindings'}.zsh \
atclone'
autoreconf -fi && \
./configure --with-oniguruma=builtin && \
make && \
ln -sfv $PWD/jq.1 $ZPFX/man/man1' \
as'null' \
if'(( ! ${+commands[jq]} ))' lucid sbin'jq' wait stedolan/jq

# @asdf-vm/asdf

zturbo from'gh-r' as'command' for \
sbin'glow' charmbracelet/glow \
sbin'grex' pemistahl/grex

zturbo from'gh-r' as'program' for \
sbin'bat*/bat' @sharkdp/bat \
sbin'vivid*/vivid' @sharkdp/vivid \
sbin'delta*/delta' dandavison/delta \
sbin'fd*/fd' @sharkdp/fd \
sbin'ripgrep*/rg' BurntSushi/ripgrep \
sbin'hyperfine*/hyperfine' @sharkdp/hyperfine \
sbin'shfmt* -> shfmt' @mvdan/sh \
sbin'nvim*/**/nvim' atinit"alias v=nvim; alias vi=nvim; alias vim=nvim" neovim/neovim \
sbin'**/exa' \
atclone'cp -vf completions/exa.zsh _exa' \
atload"alias l='ls -blF'; alias la='ls -abghilmu'
alias ll='ls -al'; alias tree='exa --tree'
alias ls='exa --git --group-directories-first'" \
ogham/exa

zinit pack"bgn" git for pyenv

zinit wait svn lucid for \
OMZP::git \
OMZP::gitfast \
OMZP::macos \
as"null" PZTM::archive

#PZTM::docker \

zinit ice use"init.sh"; zinit load b4b4r07/enhancd
zinit ice lucid nocompile wait'0e' nocompletions
zinit load MenkeTechnologies/zsh-more-completions

# Syntax highlighting, Autosuggestions, Completions
# From example http://zdharma-continuum.org/zinit/wiki/Example-Minimal-Setup/
zinit wait lucid light-mode for \
atinit'zicompinit; zicdreplay' \
zdharma-continuum/fast-syntax-highlighting \
atload'_zsh_autosuggest_start' \
zsh-users/zsh-autosuggestions \
blockf atpull'zinit creinstall -q .' \
zsh-users/zsh-completions

#zinit ice use"op.plugin.zsh"; zinit load sirhc/op.plugin.zsh

zstyle ":omz:plugins:ssh-agent" identities id_ed25519
zstyle ":omz:plugins:ssh-agent" agent-forwarding on

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
source ${HOME}/.zplug/init.zsh

zstyle ":prezto:module:terminal" auto-title "yes"
zstyle ":prezto:module:terminal:window-title" format "%n@%m: %s"
zstyle ":prezto:module:terminal:tab-title" format "%m: %s"
zstyle ":prezto:module:terminal:multiplexer-title" format "%s"
PATH="${HOME}/bin:${HOME}/go/bin:${PATH}"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# zstyle ":prezto:module:tmux:auto-start" local "yes"
# zstyle ":prezto:module:tmux:auto-start" remote "yes"
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

zplug "romkatv/powerlevel10k", as:theme, depth:1

zplug "junegunn/fzf", \
from:github, \
as:command, \
rename-to:fzf, \
hook-build:"./install --all"

zplug "b4b4r07/enhancd", use:init.sh

zplug "/home/linuxbrew/.linuxbrew/share/zsh", from:local

ohmyzsh_plugins=(
git
kubectl
docker
terraform
pip
python
brew
)
for plugin ($ohmyzsh_plugins); do
zplug "plugins/${plugin}", from:oh-my-zsh
done

prezto_plugins=(
"history"
command-not-found
)
for plugin ($prezto_plugins); do
zplug "modules/${plugin}", from:prezto
done

# If the defer tag is given 2 or above, run after compinit command
zplug "zsh-users/zsh-syntax-highlighting", defer:2

if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi

PATH="${HOME}/bin:${HOME}/go/bin:${PATH}"
zplug load

if [[ `uname` == "Darwin" ]]; then
# zstyle ":prezto:module:tmux:iterm" integrate "yes"
zstyle ":omz:plugins:ssh-agent" ssh-add-args --apple-use-keychain
[[ ! -f ${HOME}/.p10k.zsh ]] || source ${HOME}/.p10k.zsh
(( ! ${+functions[p10k]} )) || p10k finalize

PATH="/usr/local/opt/coreutils/libexec/gnubin:${PATH}"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:${MANPATH}"
export LESSOPEN="| src-hilite-lesspipe.sh %s"
export LESS=' -R '
[[ ! -f ${HOME}/.fzf.zsh ]] || source ${HOME}/.fzf.zsh

test -e "${HOME}/.dircolors" && eval $(dircolors -b "${HOME}/.dircolors")
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
[[ $(uname --kernel-release) == *"WSL2"* ]] && source ${HOME}/.ssh-agent-bridge.sh

# heroku autocomplete setup
HEROKU_AC_ZSH_SETUP_PATH="${HOME}/Library/Caches/heroku/autocomplete/zsh_setup" && test -f $HEROKU_AC_ZSH_SETUP_PATH && source $HEROKU_AC_ZSH_SETUP_PATH
else
test -e "${HOME}/.dircolors" && eval $(dircolors "${HOME}/.dircolors")
fi
source ${HOME}/.keybindings.zsh

alias tf="terraform"
alias cat="bat"
alias less="bat"
# alias tf="terraform"
alias tfp="terraform plan"
alias tfa="terraform apply"
# alias tg="terragrunt"
alias tgp="terragrunt plan"
alias tga="terragrunt apply"
alias tgaa="terragrunt apply -auto-approve"
alias tgar="terragrunt apply -auto-approve -refresh-only"

# file rename magick
bindkey '^[m' copy-prev-shell-word

load-tfswitch() {
if [[ "$PWD" =~ "terraform" ]]; then
tfswitch
fi
}
#add-zsh-hook chpwd load-tfswitch
#load-tfswitch
export BAT_THEME=Nord
export EDITOR="nvim"
export ENHANCD_DISABLE_HOME=1
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=8"
export LS_COLORS="$(vivid generate nord)"
export FZF_DEFAULT_COMMAND="fd --type file"
export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}"
export SSH_AUTH_SOCK="${HOME}/.1password/agent.sock"

load-tgswitch() {
if [[ "$PWD" =~ "terraform/live" ]]; then
tgswitch
fi
}
#add-zsh-hook chpwd load-tgswitch
#load-tgswitch
zplug check b4b4r07/enhancd && export ENHANCD_FILTER=fzf-tmux

gen-rand() {
length=24
Expand All @@ -170,32 +78,13 @@ gen-rand() {
tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c $length ; echo
}

export ENHANCD_DISABLE_HOME=1
export BAT_THEME=Nord
#if [[ `echo $(pyenv which awsume 2>/dev/null)` != "" ]]; then
# alias awsume="source \$(pyenv which awsume)"
# fpath+=( ${HOME}/.awsume/zsh-autocomplete )
#fi
#
#if [[ `echo $(pyenv which awsume 2>/dev/null)` != "" ]]; then
# alias awsume="source \$(pyenv which awsume)"
# fpath+=( ${HOME}/.awsume/zsh-autocomplete )
#fi

# Created by `pipx` on 2022-03-01 18:35:15
#export PATH="$PATH:/Users/mikehennessy/.local/bin"
#autoload -U bashcompinit
#bashcompinit
#eval "$(register-python-argcomplete pipx)"
#eval $(register-python-argcomplete pipx)
#eval "$(goenv init -)"

export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=8"
export EDITOR="nvim"

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
(( ! ${+functions[p10k]} )) || p10k finalize

eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
[[ $commands[kubectl] ]] && source <(kubectl completion zsh)
alias cat='bat'
alias l='ls -blF'
alias la='ls -abghilmu'
alias less="bat"
alias ll='ls -al'
alias ls='exa --git --group-directories-first'
alias tree='exa --tree'
alias v=nvim
alias vi=nvim
alias vim=nvim

0 comments on commit 5cac8ad

Please sign in to comment.