trevorparker/zshuriken — Issue #8: Script headers, comments, and style
Author: trevorparker
Created: 2011-12-10 00:39:26+00:00
State: open

We need a consistent header and comment policy, and a general style guideline to make the scripts readable in an easy and consistent way. All options welcome; my current style:

####
# zshuriken aliases
#

# ls niceness
#
alias l='ls'
alias ll='ls -l'
alias la='ls -a'
alias lsa='ls -a'
alias lah='ls -ah'
alias lsah='ls -ah'
alias lahl='ls -ahl'
alias lsahl='ls -ahl'
#
# color ls output
#
ls --color &> /dev/null && alias ls='ls --color=tty' || alias ls='ls -G' # this is related to, but obviously separate from, the above code

# easy navigation
#
alias ~~='cd $HOME' # this section of code is new

This probably isn't a popular choice, but I'm currently indenting two spaces. I'm good with changing this, but we need to all agree on one method. Also, comments and headers are already inconsistent in the code; theoretically, this is how it should look:

####
# zshuriken
# Confucius say, "It will blow your mind off."
#

# Initialize the core files
#
for zskn_sys_core ($ZSKN_SYSTEM/core/*.zskn) source $zskn_sys_core
for zskn_usr_core ($ZSKN_USER/core/*.zskn) source $zskn_usr_core 2> /dev/null

# Initialize everything expected in .zshrc
#
# Theme
# TODO: move this next line to some place more better
#
setopt prompt_subst # Allows us to use PROMPT='' to set theme
if [ -f $ZSKN_USER/themes/$ZSKN_THEME.zskn ]; then
source $ZSKN_USER/themes/$ZSKN_THEME.zskn
elif [ -f $ZSKN_SYSTEM/themes/$ZSKN_THEME.zskn ]; then
source $ZSKN_SYSTEM/themes/$ZSKN_THEME.zskn
else
source $ZSKN_SYSTEM/themes/default.zskn
fi
#
# Plugins
#
for plugin ($ZSKN_PLUGINS); do
if [ -f $ZSKN_USER/plugins/$plugin.zskn ]; then
source $ZSH_USER/plugins/$plugin.zskn
elif [ -f $ZSKN_SYSTEM/plugins/$plugin.zskn ]; then
source $ZSKN_SYSTEM/plugins/$plugin.zskn
fi
done