1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 12:48:01 +00:00

Make osx functions autoloadable

This commit is contained in:
Sorin Ionescu 2014-02-02 20:08:21 -05:00
parent b8bb51d7b5
commit bccfca8c10
4 changed files with 24 additions and 20 deletions

View File

@ -9,8 +9,7 @@ Aliases
- `cdf` changes the current working director to the current _Finder_ - `cdf` changes the current working director to the current _Finder_
directory. directory.
- `pushdf` pushes the current working directory onto the directory queue and - `pushdf` pushes the current working directory onto the directory queue and
- `ql` quick looks at files. changes the current working director to the current _Finder_ directory.
- `rm-osx-cruft` deletes .DS\_Store, \_\_MACOSX cruft.
Functions Functions
--------- ---------
@ -20,6 +19,8 @@ Functions
- `pfd` prints the current _Finder_ directory. - `pfd` prints the current _Finder_ directory.
- `pfs` prints the current _Finder_ selection. - `pfs` prints the current _Finder_ selection.
- `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]). - `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]).
- `ql` previews files in Quick Look.
- `rm-osx-cruft` deletes .DS\_Store, \_\_MACOSX cruft.
Authors Authors
------- -------

10
modules/osx/functions/ql Normal file
View 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

View 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

View File

@ -19,21 +19,3 @@ alias cdf='cd "$(pfd)"'
# Push directory to the current Finder directory. # Push directory to the current Finder directory.
alias pushdf='pushd "$(pfd)"' 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
}