From 59de8ca45f6a624663154dbc08fd2808ea30934c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 20 Apr 2017 15:53:16 +0200 Subject: zsh: Rebind C-t --- zsh/.config/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 8a9c8063..e4c9239f 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -230,6 +230,7 @@ fi if zplug check junegunn/fzf then + bindkey '^T' transpose-chars _fzf_compgen_path() { echo "$1" command find -L "$1" \ -- cgit 1.4.1 From c5eb5cf892785852c5bfe2ac672263f7e6696160 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 16:53:14 +0200 Subject: zsh: Move path modification to zshenv --- zsh/.config/zsh/.zshenv | 10 ++++++++++ zsh/.config/zsh/.zshrc | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 512dc56e..7569f527 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -46,6 +46,16 @@ then ;; esac + if [[ ${path[(I)$HOME/bin ]} ]] + then + path+=($HOME/bin) + fi + + if [[ ${path[(I)$HOME/.local/bin ]} ]] + then + path+=($HOME/.local/bin) + fi + export GTAGSCONF=~/.globalrc export GTAGSLABEL=ctags fi diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index e4c9239f..db32627a 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -24,16 +24,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) -- cgit 1.4.1 From e8ad75cc4b353fce74463c718bf75777562052d6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 16:53:30 +0200 Subject: zsh: Add go/bin to PATH --- zsh/.config/zsh/.zshenv | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 7569f527..cc647ff7 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -56,6 +56,11 @@ then path+=($HOME/.local/bin) fi + if [[ ${path[(I)$HOME/go/bin ]} ]] + then + path+=($HOME/go/bin) + fi + export GTAGSCONF=~/.globalrc export GTAGSLABEL=ctags fi -- cgit 1.4.1 From 060ce17305dd47a01e5c4f5f45cdbab80b4db7ae Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:34:25 +0200 Subject: zsh: Set ghq root --- zsh/.config/zsh/.zshenv | 2 ++ 1 file changed, 2 insertions(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index cc647ff7..758975f2 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -63,4 +63,6 @@ then export GTAGSCONF=~/.globalrc export GTAGSLABEL=ctags + + export GHQ_ROOT="$HOME/projects:$HOME/go/src" fi -- cgit 1.4.1 From 236bcfdf73cbd7277fbfd3fda2045143819c01bd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:34:43 +0200 Subject: zsh: Move zplug to ghq folder --- zsh/.config/zsh/.zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 758975f2..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 -- cgit 1.4.1 From 7aa006027e6a4d267bdfde0d5a3cf9a3a0377221 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 12:43:58 +0200 Subject: zsh: Install ghq completion --- zsh/.config/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index db32627a..62feedc2 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -17,6 +17,7 @@ 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 -- cgit 1.4.1 From e9d22a78a393d2c2e8d4c92c6d39dad8352f49fa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 12:44:13 +0200 Subject: zsh: Create function & widget to cd into ghq projects --- zsh/.config/zsh/.zshrc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 62feedc2..d72307da 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -234,6 +234,26 @@ 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 unsetopt flow_control # Let me use ^S and ^Q -- cgit 1.4.1 From 509bad987a184c1baa2600a2b1285b84c3977e72 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 12:54:28 +0200 Subject: zsh: Setup fast syntax highlighting --- zsh/.config/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index d72307da..1ef6a7ae 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 -- cgit 1.4.1 From 791213e75647812be5fa1e4ba9ee3a751cf9ab2e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 14:25:41 +0200 Subject: zsh: Remove oh-my-zsh-jira-plus --- zsh/.config/zsh/.zshrc | 7 ------- 1 file changed, 7 deletions(-) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 1ef6a7ae..c8db8f66 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -14,7 +14,6 @@ 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 @@ -125,12 +124,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 -- cgit 1.4.1 From 864aee5a0e4f7574b160e68a9767df9687ffcaa2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 15:01:20 +0200 Subject: zsh: Add eb-active-environment function --- zsh/.config/zsh/.zshrc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index c8db8f66..21a52b15 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -250,4 +250,8 @@ then 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 -- cgit 1.4.1 From c25428de28d56b9d0c7c271380d6cfc1cc84fcf8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 15:01:34 +0200 Subject: zsh: Make matching fuzzier It will now complete from the right, if there are no leftward completions, and then from both sides if necessary --- zsh/.config/zsh/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 21a52b15..207bff79 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -116,7 +116,7 @@ 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] ]] -- cgit 1.4.1 From 183364854a7c61eb2d46c5536926b707ec2cf2c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 15:31:26 +0200 Subject: zsh: Add hashed directories for GHQ_ROOT and GOPATH --- zsh/.config/zsh/.zshrc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 207bff79..23f852e1 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -112,6 +112,10 @@ 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 -- cgit 1.4.1