23657840a1ca31ffbce8f84d96d3063f5b4b4319

Author
Xavier Lacoste <xavier.lacoste@inria.fr>
Committer
Xavier Lacoste <xavier.lacoste@inria.fr>
Date

Message

Merge remote-tracking branch 'upstream/master'

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
  2index 6f0edb062ac60bba4abc7b5fe84962ba286f8dee..d367863b86f2baff8892278b06259370e0f02164 100644
  3--- a/plugins/autojump/autojump.plugin.zsh
  4+++ b/plugins/autojump/autojump.plugin.zsh
  5@@ -3,6 +3,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed
  6     . /usr/share/autojump/autojump.zsh
  7   elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
  8     . /etc/profile.d/autojump.zsh
  9+  elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
 10+    . /opt/local/etc/profile.d/autojump.zsh
 11   elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew
 12     . `brew --prefix`/etc/autojump
 13   fi
 14diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
 15index 39b76ecdf9d8af6221430461b99c545bae2a804f..2305c49796f58b4ae2e5b79943245f83b0e06448 100644
 16--- a/plugins/bundler/bundler.plugin.zsh
 17+++ b/plugins/bundler/bundler.plugin.zsh
 18@@ -6,7 +6,7 @@ alias bu="bundle update"
 19 
 20 # The following is based on https://github.com/gma/bundler-exec
 21 
 22-bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
 23+bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
 24 
 25 ## Functions
 26 
 27diff --git a/plugins/colemak/colemak-less b/plugins/colemak/colemak-less
 28new file mode 100644
 29index 0000000000000000000000000000000000000000..e4ca4facd65707c1f2ada112fb8781664439e637
 30--- /dev/null
 31+++ b/plugins/colemak/colemak-less
 32@@ -0,0 +1,6 @@
 33+n    forw-line
 34+e    back-line
 35+k    repeat-search
 36+\ek  repeat-search-all
 37+K    reverse-search
 38+\eK  reverse-search-all
 39diff --git a/plugins/colemak/colemak.plugin.zsh b/plugins/colemak/colemak.plugin.zsh
 40new file mode 100644
 41index 0000000000000000000000000000000000000000..34d42c280423836a39582089b504d240718a3f35
 42--- /dev/null
 43+++ b/plugins/colemak/colemak.plugin.zsh
 44@@ -0,0 +1,22 @@
 45+# ctrl-j newline
 46+bindkey '^n' accept-line
 47+bindkey -a '^n' accept-line
 48+
 49+# another rotation to match qwerty
 50+bindkey -a 'n' down-line-or-history
 51+bindkey -a 'e' up-line-or-history
 52+bindkey -a 'i' vi-forward-char
 53+
 54+# make qwerty
 55+bindkey -a 'k' vi-repeat-search
 56+bindkey -a 'K' vi-rev-repeat-search
 57+bindkey -a 'u' vi-insert
 58+bindkey -a 'U' vi-insert-bol
 59+bindkey -a 'l' vi-undo-change
 60+bindkey -a 'N' vi-join
 61+
 62+# spare
 63+bindkey -a 'j' vi-forward-word-end
 64+bindkey -a 'J' vi-forward-blank-word-end
 65+
 66+lesskey $ZSH_CUSTOM/plugins/colemak/colemak-less
 67diff --git a/plugins/per-directory-history/per-directory-history.plugin.zsh b/plugins/per-directory-history/per-directory-history.plugin.zsh
 68new file mode 100644
 69index 0000000000000000000000000000000000000000..22383b8b96cf7ff31738fe4ebf3d9a8f28223e13
 70--- /dev/null
 71+++ b/plugins/per-directory-history/per-directory-history.plugin.zsh
 72@@ -0,0 +1,148 @@
 73+#!/usr/bin/env zsh
 74+#
 75+# This is a implementation of per directory history for zsh, some 
 76+# implementations of which exist in bash[1,2].  It also implements 
 77+# a per-directory-history-toggle-history function to change from using the 
 78+# directory history to using the global history.  In both cases the history is 
 79+# always saved to both the global history and the directory history, so the 
 80+# toggle state will not effect the saved histories.  Being able to switch 
 81+# between global and directory histories on the fly is a novel feature as far 
 82+# as I am aware.
 83+#
 84+#-------------------------------------------------------------------------------
 85+# Configuration
 86+#-------------------------------------------------------------------------------
 87+#
 88+# HISTORY_BASE a global variable that defines the base directory in which the 
 89+# directory histories are stored
 90+#
 91+#-------------------------------------------------------------------------------
 92+# History
 93+#-------------------------------------------------------------------------------
 94+#
 95+# The idea/inspiration for a per directory history is from Stewart MacArthur[1] 
 96+# and Dieter[2], the implementation idea is from Bart Schaefer on the the zsh 
 97+# mailing list[3].  The implementation is by Jim Hester in September 2012.
 98+#
 99+# [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
100+# [2]: http://dieter.plaetinck.be/per_directory_bash
101+# [3]: http://www.zsh.org/mla/users/1997/msg00226.html
102+#
103+################################################################################
104+#
105+# Copyright (c) 2012 Jim Hester
106+#
107+# This software is provided 'as-is', without any express or implied warranty.  
108+# In no event will the authors be held liable for any damages arising from the 
109+# use of this software.
110+#
111+# Permission is granted to anyone to use this software for any purpose, 
112+# including commercial applications, and to alter it and redistribute it 
113+# freely, subject to the following restrictions:
114+#
115+# 1. The origin of this software must not be misrepresented; you must not claim 
116+# that you wrote the original software. If you use this software in a product, 
117+# an acknowledgment in the product documentation would be appreciated but is 
118+# not required.
119+#
120+# 2. Altered source versions must be plainly marked as such, and must not be 
121+# misrepresented as being the original software.
122+#
123+# 3. This notice may not be removed or altered from any source distribution..
124+#
125+################################################################################
126+
127+#-------------------------------------------------------------------------------
128+# configuration, the base under which the directory histories are stored
129+#-------------------------------------------------------------------------------
130+
131+[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history"
132+
133+#-------------------------------------------------------------------------------
134+# toggle global/directory history used for searching - ctrl-G by default
135+#-------------------------------------------------------------------------------
136+
137+function per-directory-history-toggle-history() {
138+  if [[ $_per_directory_history_is_global == true ]]; then
139+    _per-directory-history-set-directory-history
140+    echo "using local history\n"
141+  else
142+    _per-directory-history-set-global-history
143+    echo "using global history\n"
144+  fi
145+  zle reset-prompt
146+}
147+
148+autoload per-directory-history-toggle-history
149+zle -N per-directory-history-toggle-history
150+bindkey '^G' per-directory-history-toggle-history
151+
152+#-------------------------------------------------------------------------------
153+# implementation details
154+#-------------------------------------------------------------------------------
155+
156+_per_directory_history_directory="$HISTORY_BASE${PWD:A}/history"
157+
158+function _per-directory-history-change-directory() {
159+  _per_directory_history_directory="$HISTORY_BASE${PWD:A}/history"
160+  mkdir -p ${_per_directory_history_directory:h}
161+  if [[ $_per_directory_history_is_global == false ]]; then
162+    #save to the global history
163+    fc -AI $HISTFILE
164+    #save history to previous file
165+    local prev="$HISTORY_BASE${OLDPWD:A}/history"
166+    mkdir -p ${prev:h}
167+    fc -AI $prev
168+
169+    #discard previous directory's history
170+    local original_histsize=$HISTSIZE
171+    HISTSIZE=0
172diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
173index c47ab72114562251e4ca75f1395dcaea1abe2002..d29eb1dda85de0b8aa9416643166c5f4081d468b 100644
174--- a/plugins/vi-mode/vi-mode.plugin.zsh
175+++ b/plugins/vi-mode/vi-mode.plugin.zsh
176@@ -5,7 +5,12 @@ function zle-line-init zle-keymap-select {
177 zle -N zle-line-init
178 zle -N zle-keymap-select
179 
180+#changing mode clobbers the keybinds, so store the keybinds before and execute 
181+#them after
182+binds=`bindkey -L`
183 bindkey -v
184+for bind in ${(@f)binds}; do eval $bind; done
185+unset binds
186 
187 # if mode indicator wasn't setup by theme, define default
188 if [[ "$MODE_INDICATOR" == "" ]]; then