Browse Source

Make osx functions autoloadable

master
Sorin Ionescu 11 years ago
parent
commit
bccfca8c10
  1. 5
      modules/osx/README.md
  2. 10
      modules/osx/functions/ql
  3. 11
      modules/osx/functions/rm-osx-cruft
  4. 18
      modules/osx/init.zsh

5
modules/osx/README.md

@ -9,8 +9,7 @@ Aliases @@ -9,8 +9,7 @@ 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
---------
@ -20,6 +19,8 @@ Functions @@ -20,6 +19,8 @@ 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]).
- `ql` previews files in Quick Look.
- `rm-osx-cruft` deletes .DS\_Store, \_\_MACOSX cruft.
Authors
-------

10
modules/osx/functions/ql

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
#
# Previews files in Quick Look.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
if (( $# > 0 )); then
qlmanage -p "$@" &> /dev/null
fi

11
modules/osx/functions/rm-osx-cruft

@ -0,0 +1,11 @@ @@ -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

18
modules/osx/init.zsh

@ -19,21 +19,3 @@ alias cdf='cd "$(pfd)"' @@ -19,21 +19,3 @@ alias cdf='cd "$(pfd)"'
# Push 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
}

Loading…
Cancel
Save