summary refs log tree commit diff stats
path: root/zsh
diff options
context:
space:
mode:
authorAlan Pearce2017-05-21 11:14:56 +0200
committerAlan Pearce2017-05-21 11:14:56 +0200
commit97ac5faeee65e79d49bfa49d321f4d45772d6ec0 (patch)
tree00de7207f908fe2acfff88d519c01e761076c4be /zsh
parent8cb99ca85533e3252289e0ccb5ebe1dc8c98fa15 (diff)
parent80ff771431d668bff8c73461c606c8f1517752dd (diff)
downloaddotfiles-97ac5faeee65e79d49bfa49d321f4d45772d6ec0.tar.lz
dotfiles-97ac5faeee65e79d49bfa49d321f4d45772d6ec0.tar.zst
dotfiles-97ac5faeee65e79d49bfa49d321f4d45772d6ec0.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.config/zsh/.zshenv2
-rw-r--r--zsh/.config/zsh/.zshrc163
-rwxr-xr-xzsh/.config/zsh/setup.sh7
3 files changed, 65 insertions, 107 deletions
diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv
index d1ea38e..b42b256 100644
--- a/zsh/.config/zsh/.zshenv
+++ b/zsh/.config/zsh/.zshenv
@@ -10,8 +10,6 @@ then
     . $ZDOTDIR/zshenv.private
   fi
 
-  ZPLUG_HOME=${ZPLUG_HOME:-~/projects/github.com/zplug/zplug/}
-
   if [[ -z $SSH_AUTH_SOCK ]]
   then
     export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index 52907de..c8f951b 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -1,23 +1,5 @@
 # -*- mode: sh; -*-
-source $ZPLUG_HOME/init.zsh
-
-zplug "zsh-users/zsh-completions", depth:1, defer:0
-zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf
-zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh"
-zplug "junegunn/fzf", as:command, use:"bin/*"
-zplug "caarlos0/zsh-open-pr", as:plugin
-zplug "zdharma/fast-syntax-highlighting", as:plugin, defer:2
-zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]"
-if [[ -n $commands[nix-env] ]]
-then
-  zplug "spwhitt/nix-zsh-completions", as:plugin
-  fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions)
-fi
-
-zplug "plugins/yarn", from:oh-my-zsh, if:"[[ -n $commands[yarn] ]]"
-zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]"
-zplug "hlissner/zsh-autopair"
-zplug "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/", from:local, if:"[[ -n $commands[ghq] ]]"
+source $HOME/.zplugin/bin/zplugin.zsh
 
 HISTSIZE=3000
 SAVEHIST=10000
@@ -130,8 +112,48 @@ then
   eval $(ssh-agent)
 fi
 
-# Then, source plugins and add commands to $PATH
-zplug load
+# Plugins
+
+zplugin ice blockf
+zplugin load "zsh-users/zsh-completions"
+zplugin load "hlissner/zsh-autopair"
+zplugin load "zdharma/fast-syntax-highlighting"
+zplugin load "caarlos0/zsh-open-pr"
+zplugin ice blockf
+zplugin load "mollifier/anyframe"
+
+zplugin snippet "https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/functions.zsh"
+zplugin snippet "https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/termsupport.zsh"
+
+if [[ $os -eq darwin ]]
+then
+  zplugin load "unixorn/tumult.plugin.zsh"
+fi
+
+if [[ -n $commands[npm] ]]
+then
+  zplugin load "lukechilds/zsh-better-npm-completion"
+fi
+
+if [[ -n $commands[yarn] ]]
+then
+  zplugin snippet "https://github.com/robbyrussell/oh-my-zsh/raw/master/plugins/yarn/yarn.plugin.zsh"
+fi
+
+if [[ -n $commands[nix-env] ]]
+then
+  zplugin load "spwhitt/nix-zsh-completions"
+fi
+
+if [[ -n $commands[ghq] ]]
+then
+  fpath+=("${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/")
+fi
+
+autoload -Uz compinit
+compinit
+
+zplugin cdreplay -q
 
 # General configuration
 
@@ -161,103 +183,34 @@ else
   # show username@host if root, with username in white
   [[ $UID -eq 0 ]] && prompt_pure_username=' %F{white}%n%f%F{242}@%m%f'
 
+  ZSH_THEME_TERM_TAB_TITLE_IDLE=""
+  ZSH_THEME_TERM_TITLE_IDLE=""
+
   setopt prompt_subst
   setopt prompt_cr
   PROMPT='%F{blue}%~%f${prompt_pure_username}
 %(?.%F{magenta}.%F{red})>%f '
-
-  ## From https://github.com/robbyrussell/oh-my-zsh/blob/71deb74552d54630d99ae1db3647ebed7b3bc735/lib/termsupport.zsh
-
-  # Keep Apple Terminal.app's current working directory updated
-  # Based on this answer: http://superuser.com/a/315029
-  # With extra fixes to handle multibyte chars and non-UTF-8 locales
-
-  if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
-    # Emits the control sequence to notify Terminal.app of the cwd
-    # Identifies the directory using a file: URI scheme, including
-    # the host name to disambiguate local vs. remote paths.
-    function update_terminalapp_cwd() {
-      emulate -L zsh
-
-      # Percent-encode the pathname.
-      # Percent-encode the pathname.
-      local URL_PATH=''
-      {
-        # Use LC_CTYPE=C to process text byte-by-byte.
-        local i ch hexch LC_CTYPE=C
-        for ((i = 1; i <= ${#PWD}; ++i)); do
-          ch="$PWD[i]"
-          if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
-            URL_PATH+="$ch"
-          else
-            hexch=$(printf "%02X" "'$ch")
-            URL_PATH+="%$hexch"
-          fi
-        done
-      }
-      [[ $? != 0 ]] && return 1
-
-      printf '\e]7;%s\a' "file://$HOST$URL_PATH"
-    }
-
-    # Use a precmd hook instead of a chpwd hook to avoid contaminating output
-    precmd_functions+=(update_terminalapp_cwd)
-    # Run once to get initial cwd set
-    update_terminalapp_cwd
-  fi
-
-  function set_window_title { printf '\e]2;%s\a' "$1" }
-
-  function update_window_title {
-    if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]]
-    then
-      set_window_title "$USER@$HOST"
-    else
-      set_window_title ""
-    fi
-  }
-  precmd_functions+=(update_window_title)
 fi
 
-if zplug check junegunn/fzf
+if [[ -n $commands[fzf] ]]
 then
-  bindkey '^T' transpose-chars
-  _fzf_compgen_path() {
-    echo "$1"
-    command find -L "$1" \
-            -name .git -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \
-            -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
-  }
-
-  _fzf_compgen_dir() {
-    command find -L "$1" \
-            -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
+
+  zplugin snippet "https://github.com/junegunn/fzf/raw/master/shell/key-bindings.zsh"
+
+  bindkey '^t' transpose-chars
+
+  zstyle ":anyframe:selector:fzf:" command "fzf --height 40%"
+
+  bindkey '\es' anyframe-widget-cd-ghq-repository
+  bindkey '^x^k' anyframe-widget-kill
 fi
 
-function function eb-active-environment () {
+function eb-active-environment () {
   aws elasticbeanstalk describe-environments | grep $(dig +short $1 CNAME) | cut -f10
 }
 
 unsetopt flow_control       # Let me use ^S and ^Q
+
diff --git a/zsh/.config/zsh/setup.sh b/zsh/.config/zsh/setup.sh
new file mode 100755
index 0000000..61b5441
--- /dev/null
+++ b/zsh/.config/zsh/setup.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env zsh
+
+mkdir $HOME/.zplugin
+git clone https://github.com/psprint/zplugin.git $HOME/.zplugin/bin
+
+zcompile $HOME/.zplugin/bin/zplugin.zsh
+