Skip to content

Latest commit

 

History

History
119 lines (85 loc) · 2.86 KB

zsh-rc.org

File metadata and controls

119 lines (85 loc) · 2.86 KB

ZShell Resources Startup File

This startup file is loaded for interactive shells, so most of the things here are for callable functions, aliases and the like.

Key Bindings

On the Mac, open up the Terminal preferences, under your Basic settings, select the Keyboard tab and select the checkbox for Use option as meta key to take avantage of these.

bindkey -e

Meta-u to chdir to the parent directory and then display the contents.

bindkey -s '\eu' '^Ucd ..; ls^M'

Since AUTO_PUSHD is set, Meta-p pops the dir stack

bindkey -s '\ep' '^Upopd >/dev/null; dirs -v^M'

Pipe the current command through less with Meta-l

bindkey -s "\el" " 2>&1|less^M"

Completion

I still wonder how important it is to start up the compinstall, and auto load the compinit. I suppose it wouldn’t hurt, eh?

zstyle :compinstall filename '/Users/howard.abrams/.zshrc'

Add my own custom completion scripts:

fpath=(~/.zsh/completion $fpath)

autoload -Uz compinit
compinit

Show completion menu when number of options is at least 2

zstyle ':completion:*' menu select=2
zstyle ":completion:*:descriptions" format "%B%d%b"

Only do completion for Git, as we don’t use any other version control system anymore.

zstyle ":vcs_info:*" enable git  # svn

Modules

Using the modules from Oh My Zsh. The plugins are in ~/.oh-my-zsh/plugins/*

plugins=(osx terminalapp gnu-utils lein npm)

I use Homebrew on my home computers, but MacPorts at work. We will check to see which is installed, and then add that completion module:

if [[ -d /usr/local/Cellar ]]
then
    plugins+=(brew)      # Adds a "brews" command
else
    plugins+=(macports)  # Adds "psu" for port self_update and others
fi

Oh My Zsh

Load up the modules and other goodies from Oh my Zsh.

source $ZSH/oh-my-zsh.sh

My Functions

Each machine I’m on (work or home), may have some special functions or aliases, so let’s load anything that begins with .zshrc-:

if [[ -f $HOME/.zshrc-* ]]
then
    for SH_FILE in $HOME/.zshrc-*
    do
        source $SH_FILE
    done
fi

Technical Gunk

The following are the tangled settings. Type: C-c C-v t to create the script file.