mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 09:19:25 +00:00
Compare commits
20 Commits
pull/539-p
...
pull/582-t
Author | SHA1 | Date | |
---|---|---|---|
5e6adf89b9 | |||
bf9dbfd5b9 | |||
ff0dfa424d | |||
fedad8e9cf | |||
478653fab2 | |||
10cf701864 | |||
7722dd4400 | |||
240eecaddf | |||
415e4bff3d | |||
e5a0e33f1c | |||
8189577772 | |||
c74cf4b5e0 | |||
72782528aa | |||
02717cb4c1 | |||
bccfca8c10 | |||
b8bb51d7b5 | |||
00e12b7a98 | |||
232313e2a0 | |||
e48dac79f3 | |||
dbeb6d4e1a |
@ -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.
|
||||
|
@ -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
|
||||
-------
|
||||
@ -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
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#compdef manb manp
|
||||
#compdef mand manp
|
||||
#autoload
|
||||
|
||||
#
|
||||
# Completes manb and manp.
|
||||
# Completes mand and manp.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
@ -1,24 +0,0 @@
|
||||
#
|
||||
# Opens man pages in Bwana.app.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
function manb {
|
||||
local page
|
||||
if (( $# > 0 )); then
|
||||
for page in "$@"; do
|
||||
open "man:$page" 2>/dev/null
|
||||
if (( $? != 0 )); then
|
||||
print "$0: Bwana is not installed" >&2
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
print 'What manual page do you want?' >&2
|
||||
fi
|
||||
}
|
||||
|
||||
manb "$@"
|
||||
|
21
modules/osx/functions/mand
Normal file
21
modules/osx/functions/mand
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# Opens man pages in Dash.app.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
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
modules/osx/functions/osx-ls-download-history
Normal file
13
modules/osx/functions/osx-ls-download-history
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# Displays the Mac OS X download history.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
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
modules/osx/functions/osx-rm-dir-metadata
Normal file
11
modules/osx/functions/osx-rm-dir-metadata
Normal file
@ -0,0 +1,11 @@
|
||||
#
|
||||
# Deletes .DS_Store and __MACOSX directories.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
find "${@:-$PWD}" \( \
|
||||
-type f -name '.DS_Store' -o \
|
||||
-type d -name '__MACOSX' \
|
||||
\) -print0 | xargs -0 rm -rf
|
13
modules/osx/functions/osx-rm-download-history
Normal file
13
modules/osx/functions/osx-rm-download-history
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# Deletes the Mac OS X download history.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
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
|
@ -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
|
||||
|
||||
|
@ -5,14 +5,11 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
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
modules/osx/functions/ql
Normal file
10
modules/osx/functions/ql
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# Previews files in Quick Look.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if (( $# > 0 )); then
|
||||
qlmanage -p "$@" &> /dev/null
|
||||
fi
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,12 @@ elif (( $+commands[pyenv] )); then
|
||||
eval "$(pyenv init -)"
|
||||
|
||||
# Prepend PEP 370 per user site packages directory, which defaults to
|
||||
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH.
|
||||
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH. The
|
||||
# path can be overridden using PYTHONUSERBASE.
|
||||
else
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
if [[ -n "$PYTHONUSERBASE" ]]; then
|
||||
path=($PYTHONUSERBASE/bin $path)
|
||||
elif [[ "$OSTYPE" == darwin* ]]; then
|
||||
path=($HOME/Library/Python/*/bin(N) $path)
|
||||
else
|
||||
# This is subject to change.
|
||||
|
@ -8,7 +8,7 @@ Local Gem Installation
|
||||
----------------------
|
||||
|
||||
When a Ruby version manager is not detected, local gems are installed in
|
||||
*~/Library/Ruby/Gems/1.8* on Mac OS X.
|
||||
*~/.gems*; otherwise, they are installed according to the manager.
|
||||
|
||||
RVM
|
||||
---
|
||||
@ -20,15 +20,33 @@ home directory.
|
||||
Since RVM is loaded into the shell and is known to override shell commands, it
|
||||
may conflict with shell scripts.
|
||||
|
||||
Load this module as late as possible when using RVM since RVM will complain if
|
||||
it is not first in `$PATH`.
|
||||
|
||||
rbenv
|
||||
-----
|
||||
|
||||
An alternative RVM is to use [rbenv][3], which allows for switching between multiple,
|
||||
isolated Ruby installations in the home directory.
|
||||
An alternative RVM is to use [rbenv][3], which allows for switching between
|
||||
multiple, isolated Ruby installations in the home directory.
|
||||
|
||||
While it is not as feature rich as RVM, it is not loaded into the shell and is
|
||||
not known to cause conflicts with shell scripts.
|
||||
|
||||
chruby
|
||||
------
|
||||
|
||||
Yet another alternative is [chruby][6], which is simpler than both RVM and
|
||||
rbenv.
|
||||
|
||||
### Settings
|
||||
|
||||
#### Auto-Switch
|
||||
|
||||
To enable auto switching the Ruby version on directory change based on the
|
||||
.ruby-version file, add the following line to *zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:ruby:chruby' auto-switch 'yes'
|
||||
|
||||
Bundler
|
||||
-------
|
||||
|
||||
@ -87,4 +105,4 @@ Authors
|
||||
[3]: https://github.com/sstephenson/rbenv
|
||||
[4]: http://gembundler.com
|
||||
[5]: https://github.com/sorin-ionescu/prezto/issues
|
||||
|
||||
[6]: https://github.com/postmodern/chruby
|
||||
|
@ -18,6 +18,8 @@ if (( $+commands[rvm-prompt] )); then
|
||||
version="$(rvm-prompt)"
|
||||
elif (( $+commands[rbenv] )); then
|
||||
version="$(rbenv version-name)"
|
||||
elif (( $+commands[ruby] )); then
|
||||
version="${${$(ruby --version)[(w)1,(w)2]}/ /-}"
|
||||
fi
|
||||
|
||||
# Format version.
|
||||
|
@ -23,6 +23,13 @@ elif [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then
|
||||
elif (( $+commands[rbenv] )); then
|
||||
eval "$(rbenv init - --no-rehash zsh)"
|
||||
|
||||
# Load package manager installed chruby into the shell session.
|
||||
elif (( $+commands[chruby-exec] )); then
|
||||
source "${commands[chruby-exec]:h:h}/share/chruby/chruby.sh"
|
||||
if zstyle -t ':prezto:module:ruby:chruby' auto-switch; then
|
||||
source "${commands[chruby-exec]:h:h}/share/chruby/auto.sh"
|
||||
fi
|
||||
|
||||
# Prepend local gems bin directories to PATH.
|
||||
else
|
||||
path=($HOME/.gem/ruby/*/bin(N) $path)
|
||||
|
@ -15,7 +15,7 @@ fi
|
||||
# Auto Start
|
||||
#
|
||||
|
||||
if [[ -z "$STY" ]] && ( \
|
||||
if [[ -z "$STY" && -z "$EMACS" && -z "$VIM" ]] && ( \
|
||||
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:screen:auto-start' remote ) ||
|
||||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:screen:auto-start' local ) \
|
||||
); then
|
||||
|
@ -20,12 +20,25 @@ following line to *zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
||||
|
||||
In both cases, it will create a background session named _#Prezto_ and attach
|
||||
every new shell to it.
|
||||
In both cases the tmux server will be started and a background session
|
||||
named _prezto_ will be created if a session doesn't already exist.
|
||||
|
||||
By default every shell shares a set of windows but has an independent
|
||||
view. Detaching from one of these sessions removes the view but the
|
||||
open windows persist. This is accomplished by setting the
|
||||
`destroy-unattached` option to `on` for each session.
|
||||
|
||||
Some users prefer that all new shells share the same session so that
|
||||
the view for each shell is in sync. This useful for advanced users
|
||||
that create multiple sessions and want to manually navigate between
|
||||
them. To accomplish this behavior set the `mode` option to `shared` in
|
||||
*zpreztorc*,
|
||||
|
||||
zstyle ':prezto:module:tmux:auto-start' mode shared
|
||||
|
||||
You can customize the background session by creating a new session in
|
||||
your `.tmux.conf` file.
|
||||
|
||||
To avoid keeping open sessions, this module sets `destroy-unattached off` on
|
||||
the background session and `destroy-unattached on` on every other session
|
||||
(global setting).
|
||||
|
||||
Aliases
|
||||
-------
|
||||
@ -41,7 +54,7 @@ connected** to be displayed, which can be fixed by installing
|
||||
[reattach-to-user-namespace][3], available in [Homebrew][4], and adding the
|
||||
following to *tmux.conf*:
|
||||
|
||||
set-option -g default-command "reattach-to-user-namespace -l $SHELL -l"
|
||||
set-option -g default-command "reattach-to-user-namespace -l $SHELL -l"
|
||||
|
||||
Furthermore, tmux is known to cause **kernel panics** on Mac OS X. A discussion
|
||||
about this and Prezto has already been [opened][2].
|
||||
@ -54,6 +67,7 @@ Authors
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
- [Colin Hebert](https://github.com/ColinHebert)
|
||||
- [Georges Discry](https://github.com/gdiscry)
|
||||
- [Xavier Cambar](https://github.com/xcambar)
|
||||
|
||||
[1]: http://tmux.sourceforge.net
|
||||
[2]: https://github.com/sorin-ionescu/prezto/issues/62
|
||||
|
@ -5,6 +5,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
# Colin Hebert <hebert.colin@gmail.com>
|
||||
# Georges Discry <georges@discry.be>
|
||||
# Xavier Cambar <xcambar@gmail.com>
|
||||
#
|
||||
|
||||
# Return if requirements are not found.
|
||||
@ -16,31 +17,29 @@ fi
|
||||
# Auto Start
|
||||
#
|
||||
|
||||
if [[ -z "$TMUX" ]] && ( \
|
||||
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \
|
||||
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
|
||||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
|
||||
); then
|
||||
tmux_session='#Prezto'
|
||||
tmux start-server
|
||||
|
||||
if ! tmux has-session -t "$tmux_session" 2> /dev/null; then
|
||||
# Ensure that tmux server is started.
|
||||
tmux start-server
|
||||
|
||||
# Disable the destruction of unattached sessions globally.
|
||||
tmux set-option -g destroy-unattached off &> /dev/null
|
||||
|
||||
# Create a new session.
|
||||
tmux new-session -d -s "$tmux_session"
|
||||
|
||||
# Disable the destruction of the new, unattached session.
|
||||
tmux set-option -t "$tmux_session" destroy-unattached off &> /dev/null
|
||||
|
||||
# Enable the destruction of unattached sessions globally to prevent
|
||||
# an abundance of open, detached sessions.
|
||||
tmux set-option -g destroy-unattached on &> /dev/null
|
||||
# Create a 'prezto' session if no session has been defined in tmux.conf.
|
||||
if ! tmux has-session 2> /dev/null; then
|
||||
tmux \
|
||||
new-session -d -s prezto \; \
|
||||
set-option -t prezto destroy-unattached off &> /dev/null
|
||||
else
|
||||
tmux_session
|
||||
fi
|
||||
|
||||
exec tmux new-session -t "$tmux_session"
|
||||
if zstyle -t ':prezto:module:tmux:auto-start' mode shared; then
|
||||
# Attach to the 'prezto' session or to the last session used.
|
||||
exec tmux attach
|
||||
else
|
||||
# Find a session to share windows with.
|
||||
tmux_session=`tmux list-sessions -F '#S' | head -n 1`
|
||||
exec tmux new-session -t "$tmux_session"\; set-option destroy-unattached on
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -50,6 +50,7 @@ Aliases
|
||||
|
||||
### Disabled File Globbing
|
||||
|
||||
- `bower`
|
||||
- `fc`
|
||||
- `find`
|
||||
- `ftp`
|
||||
|
@ -34,6 +34,7 @@ alias mysql='nocorrect mysql'
|
||||
alias rm='nocorrect rm'
|
||||
|
||||
# Disable globbing.
|
||||
alias bower='noglob bower'
|
||||
alias fc='noglob fc'
|
||||
alias find='noglob find'
|
||||
alias ftp='noglob ftp'
|
||||
|
@ -87,6 +87,13 @@ zstyle ':prezto:module:editor' key-bindings 'emacs'
|
||||
# Auto set to 'off' on dumb terminals.
|
||||
zstyle ':prezto:module:prompt' theme 'sorin'
|
||||
|
||||
#
|
||||
# Ruby
|
||||
#
|
||||
|
||||
# Auto switch the Ruby version on directory change.
|
||||
# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes'
|
||||
|
||||
#
|
||||
# Screen
|
||||
#
|
||||
@ -145,4 +152,3 @@ zstyle ':prezto:module:prompt' theme 'sorin'
|
||||
|
||||
# Auto start a session when Zsh is launched in a SSH connection.
|
||||
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
||||
|
||||
|
Reference in New Issue
Block a user