Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master: (54 commits)
  Support $PYTHONUSERBASE per PEP 370
  Create a default tmux session only when none defined in tmux.conf
  Fix git-info added/deleted count formatting typo
  [Fix sorin-ionescu#543] Do not set tmux destroy-unattached
  Simplify multiplexer auto-start tests
  Inform the user to load ruby as late as possible when using RVM
  [Fix sorin-ionescu#551] Rename tmux auto-start session
  Fix a test operator bug introduced in e5a0e33
  [Fix sorin-ionescu#541] Do not auto-load screen/tmux inside of Emacs/Vim
  Disable glob for bower
  Prefix rarely used osx functions
  Add functions to display and delete osx download history
  Update osx alias descriptions
  Make osx functions autoloadable
  Cast AppleScript paths to text
  Add capability to browse man pages in Dash.app
  Remove Bwana.app support
  Add double slash after Bwana.app's man protocol
  [Fix sorin-ionescu#361] Load chruby when found
  [Fix sorin-ionescu#535] Set Pacman frontend to 'pacman' when none set
  ...

Conflicts:
	runcoms/zshenv
  • Loading branch information
daves-hubdoc committed Aug 2, 2014
2 parents 05663c6 + bf9dbfd commit 41c4fbc
Show file tree
Hide file tree
Showing 37 changed files with 429 additions and 255 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Installation
------------

Prezto will work with any recent release of Zsh, but the minimum recommended
version is 4.3.10.
version is 4.3.11.

1. Launch Zsh:

Expand All @@ -36,7 +36,7 @@ version is 4.3.10.
### Troubleshooting

If you are not able to find certain commands after switching to *Prezto*,
modify the `PATH` variable in *~/.zshenv* then open a new Zsh terminal
modify the `PATH` variable in *~/.zprofile* then open a new Zsh terminal
window or tab.

Updating
Expand Down Expand Up @@ -85,7 +85,8 @@ License

(The MIT License)

Copyright (c) 2009-2012 Robby Russell, Sorin Ionescu, and contributors.
Copyright (c) 2009-2011 Robby Russell and contributors.
Copyright (c) 2011-2014 Sorin Ionescu and 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
Expand Down
4 changes: 2 additions & 2 deletions init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#

# Check for the minimum supported version.
min_zsh_version='4.3.10'
min_zsh_version='4.3.11'
if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then
print "prezto: old shell detected, minimum required: $min_zsh_version" >&2
return 1
Expand All @@ -25,7 +25,7 @@ unset min_zsh_version
function pmodload {
local -a pmodules
local pmodule
local pfunction_glob='^([_.]*|prompt_*_setup|README*)(.N:t)'
local pfunction_glob='^([_.]*|prompt_*_setup|README*)(-.N:t)'

# $argv is overridden in the anonymous function.
pmodules=("$argv[@]")
Expand Down
41 changes: 25 additions & 16 deletions modules/editor/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -107,31 +107,40 @@ function editor-info {
}
zle -N editor-info

# Ensures that $terminfo values are valid and updates editor information when
# the keymap changes.
function zle-keymap-select zle-line-init zle-line-finish {
# Updates editor information when the keymap changes.
function zle-keymap-select {
zle editor-info
}
zle -N zle-keymap-select

# Enables terminal application mode and updates editor information.
function zle-line-init {
# The terminal must be in application mode when ZLE is active for $terminfo
# values to be valid.
if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then
case "$0" in
(zle-line-init)
# Enable terminal application mode.
echoti smkx
;;
(zle-line-finish)
# Disable terminal application mode.
echoti rmkx
;;
esac
if (( $+terminfo[smkx] )); then
# Enable terminal application mode.
echoti smkx
fi

# Update editor information.
zle editor-info
}
zle -N zle-keymap-select
zle -N zle-line-finish
zle -N zle-line-init

# Disables terminal application mode and updates editor information.
function zle-line-finish {
# The terminal must be in application mode when ZLE is active for $terminfo
# values to be valid.
if (( $+terminfo[rmkx] )); then
# Disable terminal application mode.
echoti rmkx
fi

# Update editor information.
zle editor-info
}
zle -N zle-line-finish

# Toggles emacs overwrite mode and updates editor information.
function overwrite-mode {
zle .overwrite-mode
Expand Down
4 changes: 2 additions & 2 deletions modules/git/functions/git-info
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ function git-info {
# Format added.
if (( added > 0 )); then
zstyle -s ':prezto:module:git:info:added' format 'added_format'
zformat -f added_formatted "$added_format" "a:$added_format"
zformat -f added_formatted "$added_format" "a:$added"
fi

# Format deleted.
if (( deleted > 0 )); then
zstyle -s ':prezto:module:git:info:deleted' format 'deleted_format'
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
zformat -f deleted_formatted "$deleted_format" "d:$deleted"
fi

# Format modified.
Expand Down
2 changes: 1 addition & 1 deletion modules/gpg/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi

# Set the default paths to gpg-agent files.
_gpg_agent_conf="$HOME/.gnupg/gpg-agent.conf"
_gpg_agent_env="$TMPDIR/gpg-agent.env"
_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env"

# Start gpg-agent if not started.
if ! ps -U "$USER" -o ucomm | grep -q gpg-agent; then
Expand Down
12 changes: 7 additions & 5 deletions modules/osx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ Aliases
- `cdf` changes the current working director to the current _Finder_
directory.
- `pushdf` pushes the current working directory onto the directory queue and
- `ql` quick looks at files.
- `rm-osx-cruft` deletes .DS\_Store, \_\_MACOSX cruft.
changes the current working director to the current _Finder_ directory.

Functions
---------

- `manb` opens _man_ pages in [_Bwana.app_][2].
- `mand` opens _man_ pages in [_Dash.app_][2].
- `manp` opens _man_ pages in _Preview.app_.
- `pfd` prints the current _Finder_ directory.
- `pfs` prints the current _Finder_ selection.
- `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]).
- `ql` previews files in Quick Look.
- `osx-rm-dir-metadata` deletes .DS\_Store, \_\_MACOSX cruft.
- `osx-ls-download-history` displays the Mac OS X download history.
- `osx-rm-download-history` deletes the Mac OS X download history.

Authors
-------
Expand All @@ -29,7 +32,6 @@ Authors
- [Sorin Ionescu](https://github.com/sorin-ionescu)

[1]: http://www.apple.com/macosx/
[2]: http://bruji.com/bwana/
[2]: http://kapeli.com/dash
[3]: http://www.iterm2.com/
[4]: https://github.com/sorin-ionescu/prezto/issues

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#compdef manb manp
#compdef mand manp
#autoload

#
# Completes manb and manp.
# Completes mand and manp.
#
# Authors:
# Sorin Ionescu <[email protected]>
Expand Down
24 changes: 0 additions & 24 deletions modules/osx/functions/manb

This file was deleted.

21 changes: 21 additions & 0 deletions modules/osx/functions/mand
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Opens man pages in Dash.app.
#
# Authors:
# Sorin Ionescu <[email protected]>
#

function mand {
if (( $# > 0 )); then
open "dash://manpages:$1" 2>/dev/null
if (( $? != 0 )); then
print "$0: Dash is not installed" >&2
break
fi
else
print 'What manual page do you want?' >&2
fi
}

mand "$@"

13 changes: 13 additions & 0 deletions modules/osx/functions/osx-ls-download-history
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Displays the Mac OS X download history.
#
# Authors:
# Sorin Ionescu <[email protected]>
#

local db
for db in ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV*; do
if grep -q 'LSQuarantineEvent' < <(sqlite3 "$db" .tables); then
sqlite3 "$db" 'SELECT LSQuarantineDataURLString FROM LSQuarantineEvent'
fi
done
11 changes: 11 additions & 0 deletions modules/osx/functions/osx-rm-dir-metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Deletes .DS_Store and __MACOSX directories.
#
# Authors:
# Sorin Ionescu <[email protected]>
#

find "${@:-$PWD}" \( \
-type f -name '.DS_Store' -o \
-type d -name '__MACOSX' \
\) -print0 | xargs -0 rm -rf
13 changes: 13 additions & 0 deletions modules/osx/functions/osx-rm-download-history
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Deletes the Mac OS X download history.
#
# Authors:
# Sorin Ionescu <[email protected]>
#

local db
for db in ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV*; do
if grep -q 'LSQuarantineEvent' < <(sqlite3 "$db" .tables); then
sqlite3 "$db" 'DELETE FROM LSQuarantineEvent; VACUUM'
fi
done
3 changes: 1 addition & 2 deletions modules/osx/functions/pfd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

osascript 2>/dev/null <<EOF
tell application "Finder"
return POSIX path of (target of window 1 as alias)
return POSIX path of (target of first window as text)
end tell
EOF

15 changes: 6 additions & 9 deletions modules/osx/functions/pfs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
# Sorin Ionescu <[email protected]>
#

osascript 2>/dev/null <<EOF
set output to ""
osascript 2>&1 <<EOF
tell application "Finder" to set the_selection to selection
set item_count to count the_selection
repeat with item_index from 1 to count the_selection
if item_index is less than item_count then set the_delimiter to "\n"
if item_index is item_count then set the_delimiter to ""
set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter
end repeat
if the_selection is not {}
repeat with an_item in the_selection
log POSIX path of (an_item as text)
end repeat
end if
EOF

10 changes: 10 additions & 0 deletions modules/osx/functions/ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Previews files in Quick Look.
#
# Authors:
# Sorin Ionescu <[email protected]>
#

if (( $# > 0 )); then
qlmanage -p "$@" &> /dev/null
fi
22 changes: 2 additions & 20 deletions modules/osx/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,8 @@ fi
# Aliases
#

# Change directory to the current Finder directory.
# Changes directory to the current Finder directory.
alias cdf='cd "$(pfd)"'

# Push directory to the current Finder directory.
# Pushes directory to the current Finder directory.
alias pushdf='pushd "$(pfd)"'

#
# Functions
#

# Open files in Quick Look.
function ql {
(( $# > 0 )) && qlmanage -p "$@" &> /dev/null
}

# Delete .DS_Store and __MACOSX directories.
function rm-osx-cruft {
find "${@:-$PWD}" \( \
-type f -name '.DS_Store' -o \
-type d -name '__MACOSX' \
\) -print0 | xargs -0 rm -rf
}

2 changes: 1 addition & 1 deletion modules/pacman/functions/pacman-list-disowned
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Sorin Ionescu <[email protected]>
#

local tmp="$TMPDIR/pacman-disowned-$UID-$$"
local tmp="${TMPDIR:-/tmp}/pacman-disowned-$UID-$$"
local db="$tmp/db"
local fs="$tmp/fs"

Expand Down
Loading

0 comments on commit 41c4fbc

Please sign in to comment.