zsh: OSX Module
A big feature of using Zsh is the Oh My Zsh project, which
houses a collection of themes (really just stylish prompts)
and modules.
If you gandered in the ~/.oh-my-zsh/plugins
directory, you probably
noticed osx
which you quickly added to your ~/.zshrc
file:
plugins=(osx terminalapp gnu-utils git)
But what does it actually do? It gives you the following functions:
tab
- opens a new tab in the current Terminal window
pfd
- returns directory name of the foremost Finder window
cdf
- cd
to the directory of the foremost Finder window
pushd
- Same, but does a pushd
quick-look
- Opens the document given using Mac's QuickLook
man-preview
- Displays a man page, but as a PDF in Preview
trash
- Instead of rm
, this moves the given file to the Trash instead
Let me explain a couple of these in greater detail.
Tab
To run a command in a new terminal tab, type something like:
$ tab top
Quite nice. However, I personally have an xtab
function in my
sh-functions.sh that does the same thing (which you can
download here). The difference between mine and theirs is
that mine can label the name of the tab, however mine only works with
Apple's Terminal application.
The oh-my-zsh module also has two iTerm specific functions:
split_tab
- Splits the current window to have two windows side-by-side
vsplit_tab
- Splits the window but they are above and below
cdf
Whatever folder a top-most Finder window has opened, you can type
cdf
to jump to it (or pfd
to just view that folder's name).
I always thought this would be a useful feature, but I seldom used
it. Once I installed Go 2 Shell, I find this even less helpful.
However, YMMV.
Summary
Reading man pages with Preview is actually quite nice, but not
something I do often. Viewing binary files, like images, by typing
quick-look
can be handy at times, but now that you know what this
module contains, you can decide on the usefulness of these functions.
Tell others about this article: