summary refs log tree commit diff stats
path: root/zsh/.config
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/.config')
-rw-r--r--zsh/.config/zsh/.zshenv19
-rw-r--r--zsh/.config/zsh/.zshrc50
2 files changed, 50 insertions, 19 deletions
diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv
index 512dc56e..b026d9a1 100644
--- a/zsh/.config/zsh/.zshenv
+++ b/zsh/.config/zsh/.zshenv
@@ -10,7 +10,7 @@ then
     . $ZDOTDIR/zshenv.private
   fi
 
-  ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug}
+  ZPLUG_HOME=${ZPLUG_HOME:-~/projects/github.com/zplug/zplug/}
 
   if [[ -z $SSH_AUTH_SOCK ]]
   then
@@ -46,6 +46,23 @@ then
       ;;
   esac
 
+  if [[ ${path[(I)$HOME/bin ]} ]]
+  then
+    path+=($HOME/bin)
+  fi
+
+  if [[ ${path[(I)$HOME/.local/bin ]} ]]
+  then
+    path+=($HOME/.local/bin)
+  fi
+
+  if [[ ${path[(I)$HOME/go/bin ]} ]]
+  then
+    path+=($HOME/go/bin)
+  fi
+
   export GTAGSCONF=~/.globalrc
   export GTAGSLABEL=ctags
+
+  export GHQ_ROOT="$HOME/projects:$HOME/go/src"
 fi
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index 8a9c8063..23f852e1 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -6,6 +6,7 @@ zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf
 zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2
 zplug "junegunn/fzf", as:command, use:"bin/*"
 zplug "caarlos0/zsh-open-pr", as:plugin
+zplug "zdharma/fast-syntax-highlighting", as:plugin
 zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]"
 if [[ -n $commands[nix-env] ]]
 then
@@ -13,10 +14,10 @@ then
   fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions)
 fi
 
-zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]"
 zplug "plugins/yarn", from:oh-my-zsh, defer:2, if:"[[ -n $commands[yarn] ]]", defer:2
 zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2
 zplug "hlissner/zsh-autopair", defer:2
+zplug "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/", from:local, if:"[[ -n $commands[ghq] ]]", defer:2
 
 HISTSIZE=3000
 SAVEHIST=10000
@@ -24,16 +25,6 @@ HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history
 
 WORDCHARS=${${WORDCHARS//[-.]}//[\/]}
 
-if [[ ${path[(I)$HOME/bin ]} ]]
-then
-  path+=($HOME/bin)
-fi
-
-if [[ ${path[(I)$HOME/.local/bin ]} ]]
-then
-  path+=($HOME/.local/bin)
-fi
-
 if [[ -d /opt/local/share/zsh/site-functions ]]
 then
   fpath+=(/opt/local/share/zsh/site-functions)
@@ -121,11 +112,15 @@ ds () {
   du -hd1 $1 | sort -h
 }
 
+# returns the first ghq root, whereas $GHQ_ROOT returns all
+hash -d p=$(ghq root)
+hash -d go=${GOPATH:-$HOME/go}
+
 zle -C hist-complete complete-word _generic
 zstyle ':completion:hist-complete:*' completer _history
 bindkey '\e ' hist-complete
 
-zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}'
+zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
 zstyle ':completion:*' completer _expand _complete _match
 
 if [[ -z $SSH_AUTH_SOCK && $commands[ssh-agent] ]]
@@ -133,12 +128,6 @@ then
   eval $(ssh-agent)
 fi
 
-if zplug check gerges/oh-my-zsh-jira-plus
-then
-  JIRA_RAPID_BOARD=true
-  JIRA_URL=https://spotcap.atlassian.net
-fi
-
 # Then, source plugins and add commands to $PATH
 zplug load
 
@@ -230,6 +219,7 @@ fi
 
 if zplug check junegunn/fzf
 then
+  bindkey '^T' transpose-chars
   _fzf_compgen_path() {
     echo "$1"
     command find -L "$1" \
@@ -242,6 +232,30 @@ then
             -name .git -prune -o -name .svn -prune -o -type d \
             -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
   }
+
+  fp () {
+    ghq look $(ghq list | fzf +m)
+  }
+  cd-project-widget () {
+    local cmd="ghq list"
+    setopt localoptions pipefail 2> /dev/null
+    local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" fzf +m)"
+    if [[ -z "$dir" ]]; then
+      zle redisplay
+      return 0
+    fi
+    cd $(ghq list --full-path | grep "$dir")
+    local ret=$?
+    zle reset-prompt
+    typeset -f zle-line-init >/dev/null && zle zle-line-init
+    return $ret
+  }
+  zle -N cd-project-widget
+  bindkey '\es' cd-project-widget
 fi
 
+function function eb-active-environment () {
+  aws elasticbeanstalk describe-environments | grep $(dig +short $1 CNAME) | cut -f10
+}
+
 unsetopt flow_control       # Let me use ^S and ^Q