Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* https://github.com/sorin-ionescu/prezto:
  Add Emacs module
  [Fix sorin-ionescu#396] Remove the osx trash function
  [Fix sorin-ionescu#398] Manually set locale
  [Fix sorin-ionescu#351] Set empty keys to an invalid UTF-8 sequence
  Add support for nvm
  Use $GNUPGHOME in GPG agent startup
  [Fix sorin-ionescu#381] Remove the path_helper workaround
  [Fix sorin-ionescu#385] Do not set $INFOPATH
  [Fix sorin-ionescu#383] Do not set $MANPATH
  Fix lesspipe.sh detection in custom PATH
  [Fix sorin-ionescu#366] Distinct position with red
  Export $MANPATH and $INFOPATH
  [Fix sorin-ionescu#349] Display diff when committing
  [Fix sorin-ionescu#360] Set alias giR to reset the index interactively
  [Fix sorin-ionescu#357] Set alias gcO to check out hunks interactively
  [Fix sorin-ionescu#355] Do not set launchd environment variables
  • Loading branch information
Caleb Epstein committed Apr 23, 2013
2 parents f26e484 + 2baa4dc commit 157ae44
Show file tree
Hide file tree
Showing 19 changed files with 138 additions and 140 deletions.
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,6 @@ version is 4.3.10.

5. Open a new Zsh terminal window or tab.

### Mac OS X

If you have administrator privileges, you must fix an Apple-introduced problem
in Mac OS X 10.5 Leopard by executing the following command, or BASH and Zsh
will have the wrong `PATH` when executed non-interactively.

sudo chmod ugo-x /usr/libexec/path_helper

`path_helper` is intended to make it easier for installers to add new paths to
the environment without having to edit shell configuration files by adding
a file with a path to the */etc/paths.d* directory.

Unfortunately, `path_helper` always reads paths from */etc/paths* set by Apple
then paths from */etc/paths.d* set by third party installers, and lastly paths
from the `PATH` environment variable set by the parent process, which
ultimately is set by the user with `export PATH=...` Thus, it reorders path
priorities, and user */bin* directories meant to override system */bin*
directories end up at the tail of the array.

### Troubleshooting

If you are not able to find certain commands after switching to *Prezto*,
Expand Down
7 changes: 3 additions & 4 deletions modules/editor/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ key_info=(
'BackTab' "$terminfo[kcbt]"
)

# Do not bind any keys if there are empty values in $key_info.
# Set empty $key_info values to an invalid UTF-8 sequence to induce silent
# bindkey failure.
for key in "${(k)key_info[@]}"; do
if [[ -z "$key_info[$key]" ]]; then
print "prezto: one or more keys are non-bindable" >&2
unset key{,_info}
return 1
key_info["$key"]=''
fi
done

Expand Down
33 changes: 33 additions & 0 deletions modules/emacs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Emacs
=====

Enables Emacs dependency management.

Dependency management
---------------------

[Carton][1] installs and manages Emacs packages for Emacs package development
and Emacs configuration.

This module prepends the Carton directory to the path variable to enable the
execution of `carton`.

Aliases
-------

### Carton

- `cai` installs dependencies.
- `cau` updates dependencies.
- `caI` initializes the current directory for dependency management.
- `cae` executes a command which correct dependencies.

Authors
-------

*The authors of this module should be contacted via the [issue tracker][2].*

- [Sebastian Wiesner](https://github.com/lunaryorn)

[1]: https://github.com/rejeep/carton
[2]: https://github.com/sorin-ionescu/prezto/issues
15 changes: 15 additions & 0 deletions modules/emacs/init.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Configures Emacs dependency management.
#
# Authors: Sebastian Wiesner <[email protected]>
#

# Enable Carton
if [[ -d "$HOME/.carton" ]]; then
path=($HOME/.carton/bin $path)

alias cai='carton install'
alias cau='carton update'
alias caI='carton init'
alias cae='carton exec'
fi
6 changes: 3 additions & 3 deletions modules/git/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Aliases
- `gca` stages all modified and deleted files.
- `gcm` records changes to the repository with the given message.
- `gco` checks out a branch or paths to work tree.
- `gcO` checks out paths to work tree using the *HEAD* commit.
- `gcO` checks out hunks from the index or the tree interactively.
- `gcf` amends the tip of the current branch using the same log message as
*HEAD*.
- `gcF` amends the tip of the current branch.
Expand Down Expand Up @@ -98,8 +98,8 @@ Aliases
- `giu` adds file contents to the index (updates only known files).
- `gid` displays changes between the index and a named commit (diff).
- `giD` displays changes between the index and a named commit (word diff).
- `gir` resets current HEAD to the specified state.
- `giR` resets current index to the specified state.
- `gir` resets the current HEAD to the specified state.
- `giR` resets the current index interactively.
- `gix` removes files/directories from the index (recursively).
- `giX` removes files/directories from the index (recursively and forced).

Expand Down
10 changes: 5 additions & 5 deletions modules/git/alias.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ alias gbs='git show-branch'
alias gbS='git show-branch -a'

# Commit (c)
alias gc='git commit'
alias gca='git commit --all'
alias gc='git commit --verbose'
alias gca='git commit --verbose --all'
alias gcm='git commit --message'
alias gco='git checkout'
alias gcO='git checkout HEAD --'
alias gcO='git checkout --patch'
alias gcf='git commit --amend --reuse-message HEAD'
alias gcF='git commit --amend'
alias gcF='git commit --verbose --amend'
alias gcp='git cherry-pick --ff'
alias gcP='git cherry-pick --no-commit'
alias gcr='git revert'
Expand Down Expand Up @@ -86,7 +86,7 @@ alias giu='git add --update'
alias gid='git diff --no-ext-diff --cached'
alias giD='git diff --no-ext-diff --cached --word-diff'
alias gir='git reset'
alias giR='git reset --keep'
alias giR='git reset --patch'
alias gix='git rm -r --cached'
alias giX='git rm -rf --cached'

Expand Down
8 changes: 5 additions & 3 deletions modules/gpg-agent/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
# Authors:
# Florian Walch <[email protected]>
# Sorin Ionescu <[email protected]>
# neersighted <[email protected]>
#

# Return if requirements are not found.
if (( ! $+commands[gpg-agent] )); then
return 1
fi

_gpg_env="$HOME/.gnupg/gpg-agent.env"
# Make sure to use the $GNUPGHOME first.
_gpg_env="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.env"

function _gpg-agent-start {
local ssh_support
Expand All @@ -20,7 +22,8 @@ function _gpg-agent-start {
|| ssh_support=''

gpg-agent \
--daemon ${ssh_support:+'--enable-ssh-support'}
--daemon \
${ssh_support:+'--enable-ssh-support'} \
--write-env-file "${_gpg_env}" > /dev/null

chmod 600 "${_gpg_env}"
Expand All @@ -41,4 +44,3 @@ export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
export GPG_TTY="$(tty)"

4 changes: 1 addition & 3 deletions modules/haskell/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ if (( ! $+commands[ghc] )); then
return 1
fi

# Prepend Cabal per user directories to PATH/MANPATH.
# Prepend Cabal per user directories to PATH.
if [[ "$OSTYPE" == darwin* && -d $HOME/Library/Haskell ]]; then
path=($HOME/Library/Haskell/bin(/N) $path)
manpath=($HOME/Library/Haskell/man(/N) $manpath)
else
path=($HOME/.cabal/bin(/N) $path)
manpath=($HOME/.cabal/man(/N) $manpath)
fi
12 changes: 0 additions & 12 deletions modules/macports/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,6 @@ fi
# Paths
#

# Set the list of directories that info searches for manuals.
infopath=(
/opt/local/share/info
$infopath
)

# Set the list of directories that man searches for manuals.
manpath=(
/opt/local/share/man
$manpath
)

# Set the list of directories that Zsh searches for programs.
path=(
/opt/local/{bin,sbin}
Expand Down
25 changes: 24 additions & 1 deletion modules/node/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
Node.js
=======

Provides utility functions for [Node.js][1] and loads [npm][2] completion.
Provides utility functions for [Node.js][1], loads the Node Version Manager, and
enables [npm][2] completion.

nvm
---

[nvm][5] allows for managing multiple, isolated Node.js installations in the
home directory.

Functions
---------

- `node-doc` opens the Node.js online [API documentation][3] in the default
browser.
- `node-info` exposes information about the Node.js environment via the
`$node_info` associative array.

Theming
-------

To display the version number of the current Node.js version, define the
following style inside the `prompt_name_setup` function.

# %v - Node.js version.
zstyle ':prezto:module:node:info:version' format 'version:%v'

Then add `$node_info[version]` to either `$PROMPT` or `$RPROMPT` and call
`node-info` in `prompt_name_preexec` hook function.

Authors
-------

*The authors of this module should be contacted via the [issue tracker][4].*

- [Sorin Ionescu](https://github.com/sorin-ionescu)
- [Zeh Rizzatti](https://github.com/zehrizzatti)

[1]: http://nodejs.org
[2]: http://npmjs.org
[3]: http://nodejs.org/api
[4]: https://github.com/sorin-ionescu/prezto/issues
[5]: https://github.com/creationix/nvm

25 changes: 25 additions & 0 deletions modules/node/functions/node-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Exposes information about the Node.js environment via the $node_info
# associative array.
#
# Authors:
# Zeh Rizzatti <[email protected]>
#

local version
local version_format
local version_formatted

unset node_info
typeset -gA node_info

if (( $+functions[nvm_version] )); then
version="${$(nvm_version)#v}"
fi

if [[ -n "$version" ]]; then
zstyle -s ':prezto:module:node:info:version' format 'version_format'
zformat -f version_formatted "$version_format" "v:$version"
node_info[version]="$version_formatted"
fi

8 changes: 7 additions & 1 deletion modules/node/init.zsh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#
# Completes npm.
# Loads the Node Version Manager and enables npm completion.
#
# Authors:
# Sorin Ionescu <[email protected]>
# Zeh Rizzatti <[email protected]>
#

# Load NVM into the shell session.
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
source "$HOME/.nvm/nvm.sh"
fi

# Return if requirements are not found.
if (( ! $+commands[node] )); then
return 1
Expand Down
1 change: 0 additions & 1 deletion modules/osx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Functions
- `pfd` prints the current _Finder_ directory.
- `pfs` prints the current _Finder_ selection.
- `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]).
- `trash` moves files and folders to _Trash_.

Authors
-------
Expand Down
27 changes: 0 additions & 27 deletions modules/osx/functions/trash

This file was deleted.

8 changes: 0 additions & 8 deletions modules/perl/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ if [[ "$OSTYPE" == darwin* ]]; then
perl_path="$HOME/Library/Perl/5.12"

if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
manpath=("$perl_path/man" $manpath)

if [[ ! -s "$cache_file" ]]; then
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
fi
Expand All @@ -31,12 +29,6 @@ if [[ "$OSTYPE" == darwin* ]]; then

unset perl_path
unset cache_file

# Set environment variables for launchd processes.
for env_var in PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT PERL5LIB; do
launchctl setenv "$env_var" "${(P)env_var}" &!
done
unset env_var
fi

#
Expand Down
2 changes: 1 addition & 1 deletion modules/prompt/functions/prompt_sorin_setup
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function prompt_sorin_setup {
zstyle ':prezto:module:git:info:commit' format ':%F{green}%.7c%f'
zstyle ':prezto:module:git:info:deleted' format ' %%B%F{red}✖%f%%b'
zstyle ':prezto:module:git:info:modified' format ' %%B%F{blue}✱%f%%b'
zstyle ':prezto:module:git:info:position' format ':%F{green}%p%f'
zstyle ':prezto:module:git:info:position' format ':%F{red}%p%f'
zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b'
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}✭%f%%b'
zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}═%f%%b'
Expand Down
4 changes: 1 addition & 3 deletions modules/python/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ if (( ! $+commands[python] && ! $+commands[pythonz] )); then
fi

# Prepend PEP 370 per user site packages directory, which defaults to
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH/MANPATH.
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH.
if [[ "$OSTYPE" == darwin* ]]; then
path=($HOME/Library/Python/*/bin(N) $path)
manpath=($HOME/Library/Python/*/{,share/}man(N) $manpath)
else
# This is subject to change.
path=($HOME/.local/bin $path)
manpath=($HOME/.local/{,share/}man(N) $manpath)
fi

# Load virtualenvwrapper into the shell session.
Expand Down
7 changes: 0 additions & 7 deletions runcoms/zlogin
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
zcompile "$zcompdump"
fi

# Set environment variables for launchd processes.
if [[ "$OSTYPE" == darwin* ]]; then
for env_var in PATH MANPATH; do
launchctl setenv "$env_var" "${(P)env_var}"
done
fi
} &!

# Print a random, hopefully interesting, adage.
Expand Down
Loading

0 comments on commit 157ae44

Please sign in to comment.