diff options
-rw-r--r-- | MIT-LICENSE.txt | 2 | ||||
-rw-r--r-- | README.textile | 4 | ||||
-rw-r--r-- | lib/termsupport.zsh | 5 | ||||
-rw-r--r-- | plugins/emacs/emacs.plugin.zsh | 56 | ||||
-rwxr-xr-x | plugins/emacs/emacsclient.sh | 12 | ||||
-rw-r--r-- | themes/bureau.zsh-theme | 6 |
6 files changed, 76 insertions, 9 deletions
diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt index f6edab65b..6eb8aab34 100644 --- a/MIT-LICENSE.txt +++ b/MIT-LICENSE.txt @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2009-2013 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors) +Copyright (c) 2009-2014 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 diff --git a/README.textile b/README.textile index 0fa9b30ec..c808fb5d7 100644 --- a/README.textile +++ b/README.textile @@ -14,11 +14,11 @@ You can install this via the command line with either `curl` or `wget`. h4. via `curl` -@curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh@ +@curl -L http://install.ohmyz.sh | sh@ h4. via `wget` -@wget --no-check-certificate https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh@ +@wget --no-check-certificate http://install.ohmyz.sh -O - | sh@ h4. Optional: change the install directory diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 80319e1a8..5f2fe63d4 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -27,9 +27,8 @@ function omz_termsupport_preexec { emulate -L zsh setopt extended_glob local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - local LINE="${2:gs/$/\\$}" - LINE="${LINE:gs/%/%%}" - title "$CMD" "%100>...>$LINE%<<" + local LINE="${2:gs/%/%%}" + title '$CMD' '%100>...>$LINE%<<' } autoload -U add-zsh-hook diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh new file mode 100644 index 000000000..a3f0085a8 --- /dev/null +++ b/plugins/emacs/emacs.plugin.zsh @@ -0,0 +1,56 @@ +# Emacs 23 daemon capability is a killing feature. +# One emacs process handles all your frames whether +# you use a frame opened in a terminal via a ssh connection or X frames +# opened on the same host. + +# Benefits are multiple +# - You don't have the cost of starting Emacs all the time anymore +# - Opening a file is as fast as Emacs does not have anything else to do. +# - You can share opened buffered across opened frames. +# - Configuration changes made at runtime are applied to all frames. + + +if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then + export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" + + # set EDITOR if not already defined. + export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" + + alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" + alias e=emacs + + # same than M-x eval but from outside Emacs. + alias eeval="$EMACS_PLUGIN_LAUNCHER --eval" + # create a new X frame + alias eframe='emacsclient --alternate-editor "" --create-frame' + + # to code all night long + alias emasc=emacs + alias emcas=emacs + + # Write to standard output the path to the file + # opened in the current buffer. + function efile { + local cmd="(buffer-file-name (window-buffer))" + "$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \" + } + + # Write to standard output the directory of the file + # opened in the the current buffer + function ecd { + local cmd="(let ((buf-name (buffer-file-name (window-buffer)))) + (if buf-name (file-name-directory buf-name)))" + + local dir="$($EMACS_PLUGIN_LAUNCHER --eval $cmd | tr -d \")" + if [ -n "$dir" ] ;then + echo "$dir" + else + echo "can not deduce current buffer filename." >/dev/stderr + return 1 + fi + } +fi + +## Local Variables: +## mode: sh +## End: diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh new file mode 100755 index 000000000..38d419813 --- /dev/null +++ b/plugins/emacs/emacsclient.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# get list of available X windows. +x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` + +if [ -z "$x" ] ;then + # Create one if there is no X window yet. + emacsclient --alternate-editor "" --create-frame "$@" +else + # prevent creating another X frame if there is at least one present. + emacsclient --alternate-editor "" "$@" +fi diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme index 1d88f54d0..4d9cae0cc 100644 --- a/themes/bureau.zsh-theme +++ b/themes/bureau.zsh-theme @@ -101,12 +101,12 @@ _1RIGHT="[%*] " bureau_precmd () { _1SPACES=`get_space $_1LEFT $_1RIGHT` - echo + print + print -rP "$_1LEFT$_1SPACES$_1RIGHT" } setopt prompt_subst -PROMPT='$_1LEFT$_1SPACES$_1RIGHT -> $_LIBERTY ' +PROMPT='> $_LIBERTY ' RPROMPT='$(nvm_prompt_info) $(bureau_git_prompt)' autoload -U add-zsh-hook |