summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-05-21 11:14:56 +0200
committerAlan Pearce2017-05-21 11:14:56 +0200
commit97ac5faeee65e79d49bfa49d321f4d45772d6ec0 (patch)
tree00de7207f908fe2acfff88d519c01e761076c4be
parent8cb99ca85533e3252289e0ccb5ebe1dc8c98fa15 (diff)
parent80ff771431d668bff8c73461c606c8f1517752dd (diff)
downloaddotfiles-97ac5faeee65e79d49bfa49d321f4d45772d6ec0.tar.lz
dotfiles-97ac5faeee65e79d49bfa49d321f4d45772d6ec0.tar.zst
dotfiles-97ac5faeee65e79d49bfa49d321f4d45772d6ec0.zip
Merge remote-tracking branch 'origin/master'
-rw-r--r--README.org15
-rw-r--r--emacs/.emacs.d/init.org44
-rw-r--r--git/.config/git/config2
-rw-r--r--git/.config/git/ignore3
-rw-r--r--yarn/.yarnrc2
-rw-r--r--zsh/.config/zsh/.zshenv2
-rw-r--r--zsh/.config/zsh/.zshrc163
-rwxr-xr-xzsh/.config/zsh/setup.sh7
8 files changed, 105 insertions, 133 deletions
diff --git a/README.org b/README.org
index 2ed0633..3acd8b2 100644
--- a/README.org
+++ b/README.org
@@ -4,7 +4,7 @@ I've organised this repository with [[https://www.gnu.org/software/stow/][GNU St
 [[http://emacs.sexy][Emacs]].
 
 It doesn't use any configuration frameworks, just packages installed
-via package managers.  For Z shell I use [[https://zplug.sh/][zplug]] and for Emacs I use the
+via package managers.  For Z shell I use [[https://github.com/zdharma/zplugin][zplugin]] and for Emacs I use the
 built-in package.el via [[https://github.com/jwiegley/use-package][use-package]].
 
 I've included a wrapper script for =stow= which sets the target
@@ -48,21 +48,12 @@ And then to uninstall
 
 *** Z Shell
 
-My zsh configuration uses [[https://zplug.sh/][zplug]], so that will need to be installed:
+My zsh configuration uses [[https://github.com/zdharma/zplugin][zplugin]]. I've included a setup script:
 
 #+BEGIN_SRC sh :exports code
-git clone git://github.com/zplug/zplug ~/projects/zplug/
+./zsh/config/zsh/setup.sh
 #+END_SRC
 
-To install the packages:
-
-#+BEGIN_SRC sh :exports code
-zsh -ic "zplug install"
-#+END_SRC
-
-Note that this will log some errors about a pipe, but that's okay.
-zplug is meant to be used in a real interactive shell.
-
 *** Emacs
 
 I use org-mode for my Emacs init file.  To simplify setup, I created a
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 78c51e5..e0b928a 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -215,11 +215,12 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource
     (cond
      ((eq window-system 'w32)
       (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11 t))
-     ((eq window-system 'ns)
+     ((or (eq window-system 'mac)
+          (eq window-system 'ns))
       (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l"))))
         (if (eq displays 1)
-            (ap/set-fonts "Lekton" 20 "Lucida Grande" 16 t)
-          (ap/set-fonts "Monaco" 14 "Lucida Grande" 14 nil 0.1))))
+            (ap/set-fonts "Monaco" 16 "Lucida Grande" 16 t 0.2)
+          (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1))))
      ((and (eq window-system 'x)
            (not (getenv "windows")))
       (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14))
@@ -1706,15 +1707,6 @@ I can use this to keep a journal.  I should use it.
 #+END_SRC
 
 
-* Music
-Emacs actually supports playing music via mpd.
-
-#+BEGIN_SRC emacs-lisp
-(use-package mpc
-  :defer t
-  :config (progn
-            (setq mpc-browser-tags '(Genre Albumartist|Composer|Performer Album|Playlist))))
-#+END_SRC
 * Programming
 ** flycheck
 
@@ -2015,6 +2007,7 @@ an AST internally, so it can work with it almost like a lisp.
             (bind-key "M-g M-n" #'js2-next-error js2-mode-map)
             (bind-key "M-g M-p" #'ap/js2-prev-error js2-mode-map)
             (setq js2-basic-offset 2
+                  js-switch-indent-offset 2
                   js2-include-node-externs t
                   js2-highlight-level 1)))
 #+END_SRC
@@ -2182,6 +2175,33 @@ I derived a mode for twig, in order to use its =mode-hook=.
 (add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode))
 #+END_SRC
 
+** Live coding
+
+Sometimes I might want to show off my emacs usage.
+
+#+BEGIN_SRC emacs-lisp
+(defun live-coding ()
+  (interactive)
+  (ap/set-fonts "SF Mono" 18 nil nil t 0.1)
+  (global-command-log-mode 1))
+
+(defun live-coding-stop ()
+  (interactive)
+  (ap/set-fonts-according-to-system)
+  (global-command-log-mode -1))
+#+END_SRC
+
+*** command-log-mode
+
+#+BEGIN_SRC emacs-lisp
+(use-package command-log-mode
+  :defines command-log-mode-key-binding-open-log
+  :init (progn
+          (setq command-log-mode-key-binding-open-log nil
+                command-log-mode-auto-show t
+                command-log-mode-is-global t)))
+#+END_SRC
+
 * Spelling
 
 #+BEGIN_SRC emacs-lisp
diff --git a/git/.config/git/config b/git/.config/git/config
index f3a62f6..c82c149 100644
--- a/git/.config/git/config
+++ b/git/.config/git/config
@@ -32,8 +32,6 @@
 	algorithm = patience
 [include]
 	path = config.local
-[core]
-	excludesfile = ~/.config/git/ignore
 [rebase]
 	autosquash = true
 [rerere]
diff --git a/git/.config/git/ignore b/git/.config/git/ignore
index d7189dc..66c652a 100644
--- a/git/.config/git/ignore
+++ b/git/.config/git/ignore
@@ -18,6 +18,9 @@ auto-save-list
 tramp
 .\#*
 
+# zsh
+*.zwc
+
 # Org-mode
 .org-id-locations
 *_archive
diff --git a/yarn/.yarnrc b/yarn/.yarnrc
new file mode 100644
index 0000000..95e833e
--- /dev/null
+++ b/yarn/.yarnrc
@@ -0,0 +1,2 @@
+disable-self-update-check true
+yarn-offline-mirror-pruning true
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
+