Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/per-directory-history'
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Aug 26, 2013
2 parents 168708a + ac6f1a0 commit ae1fc63
Show file tree
Hide file tree
Showing 14 changed files with 326 additions and 180 deletions.
21 changes: 21 additions & 0 deletions MIT-LICENSE.txt
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2009-2013 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
16 changes: 9 additions & 7 deletions lib/git.zsh
Expand Up @@ -9,13 +9,15 @@ function git_prompt_info() {
# Checks if working tree is dirty
parse_git_dirty() {
local SUBMODULE_SYNTAX=''
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
fi
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
fi
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
fi
}

Expand Down
4 changes: 3 additions & 1 deletion plugins/encode64/encode64.plugin.zsh
@@ -1,2 +1,4 @@
encode64(){ echo -n $1 | base64 }
decode64(){ echo -n $1 | base64 -D }
decode64(){ echo -n $1 | base64 -D }
alias e64=encode64
alias d64=decode64
14 changes: 14 additions & 0 deletions plugins/lein/lein.plugin.zsh
Expand Up @@ -5,15 +5,29 @@ function _lein_commands() {
case $state in
subcommand)
subcommands=(
"classpath:print the classpath of the current project"
"clean:remove compiled files and dependencies from project"
"compile:ahead-of-time compile the project"
"deploy:build jar and deploy to remote repository"
"deps:download and install all dependencies"
"help:display a list of tasks or help for a given task"
"install:install the project and its dependencies in your local repository"
"int:enter an interactive task shell"
"interactive:enter an interactive task shell"
"jack-in:jack in to a clojure slime session from emacs."
"jar:create a jar file containing the compiled .class files"
"javac:compile java source files"
"new:create a new project skeleton"
"plugin:manage user-level plugins"
"pom:write a pom.xml file to disk for maven interop"
"repl:start a repl session either with the current project or standalone"
"retest:run only the test namespaces which failed last time around"
"run:run the project's -main function"
"search:search remote maven repositories for matching jars"
"swank:launch swank server for Emacs to connect"
"test:run the project's tests"
"test!:run a project's tests after cleaning and fetching dependencies"
"trampoline:run a task without nesting the project's JVM inside Leiningen's."
"uberjar:Create a jar including the contents of each of deps"
"upgrade:upgrade leiningen to the latest stable release"
"version:print leiningen's version"
Expand Down
56 changes: 56 additions & 0 deletions plugins/per-directory-history/README.md
@@ -0,0 +1,56 @@
[Per-Directory-History][6]
=========================

Per directory history for zsh, as well as global history, and the
ability to toggle between them with ^G.

This is a implementation of per directory history for zsh, some
implementations of which exist in bash[1][],[2][]. It also implements
a per-directory-history-toggle-history function to change from using the
directory history to using the global history. In both cases the history is
always saved to both the global history and the directory history, so the
toggle state will not effect the saved histories. Being able to switch
between global and directory histories on the fly is a novel feature as far
as I am aware.

This is a standalone repository for the script, however it is also included in
[oh-my-zsh][4] as a plugin.

----------------------------------------------------------------------------
Usage
----------------------------------------------------------------------------

1. Load this script into your interactive ZSH session:

% source zsh-per-directory-history.zsh

2. The default mode if per directory history, interact with your history as normal.

3. Press ^G (the Control and G keys simultaneously) to toggle between local
and global histories.



-------------------------------------------------------------------------------
Configuration
-------------------------------------------------------------------------------

* HISTORY_BASE a global variable that defines the base directory in which the
directory histories are stored
* per-directory-history-toggle-history is the function to toggle the history

-------------------------------------------------------------------------------
History
-------------------------------------------------------------------------------

The idea/inspiration for a per directory history is from [Stewart MacArthur][1]
and [Dieter][2], the implementation idea is from [Bart Schaefer][3]. The
implementation is by [Jim Hester][5] in September 2012.

[1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
[2]: http://dieter.plaetinck.be/per_directory_bash
[3]: http://www.zsh.org/mla/users/1997/msg00226.html
[4]: https://github.com/robbyrussell/oh-my-zsh
[5]: http://jimhester.com
[6]: http://github.com/jimhester/per-directory-history

149 changes: 0 additions & 149 deletions plugins/per-directory-history/per-directory-history.plugin.zsh

This file was deleted.

0 comments on commit ae1fc63

Please sign in to comment.