Skip to content

Commit

Permalink
Moved zsh functions and changed prompt a little
Browse files Browse the repository at this point in the history
  • Loading branch information
swburk committed Jan 12, 2014
1 parent 95263a8 commit d3e47c4
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 74 deletions.
Empty file added hushlogin
Empty file.
1 change: 1 addition & 0 deletions zsh/functions/bm
@@ -0,0 +1 @@
alias $1="cd $PWD"
1 change: 1 addition & 0 deletions zsh/functions/chpwd
@@ -0,0 +1 @@
ls -Ft | head -8;
5 changes: 5 additions & 0 deletions zsh/functions/e
@@ -0,0 +1,5 @@
if [ $# -eq 0 ]; then
$EDITOR .
else
$EDITOR "$@"
fi
5 changes: 5 additions & 0 deletions zsh/functions/g
@@ -0,0 +1,5 @@
if [ $# -ne 0 ]; then
git $@
else
git status
fi
1 change: 1 addition & 0 deletions zsh/functions/http
@@ -0,0 +1 @@
curl http://httpcode.info/$1;
1 change: 1 addition & 0 deletions zsh/functions/mkcd
@@ -0,0 +1 @@
mkdir -pv "$1" && cd "$1";
3 changes: 3 additions & 0 deletions zsh/functions/precmd
@@ -0,0 +1,3 @@
vcs_info
set_prompt
print -Pn "\e];%~\a"
1 change: 1 addition & 0 deletions zsh/functions/va
@@ -0,0 +1 @@
. "$VIRTUALENV_BASE/$1/bin/activate"
1 change: 1 addition & 0 deletions zsh/functions/vn
@@ -0,0 +1 @@
virtualenv "$VIRTUALENV_BASE/$1"
1 change: 1 addition & 0 deletions zsh/functions/voc
@@ -0,0 +1 @@
echo "$1" >> $HOME/notes/vocabulary.txt
103 changes: 29 additions & 74 deletions zshrc
Expand Up @@ -12,8 +12,15 @@ setopt share_history
setopt correct
export VIRTUALENV_BASE="$HOME/.virtualenvs"

# Functions ------------------------------------------------------------------
fpath=(~/.zsh/functions $fpath)
for function in $(ls ~/.zsh/functions); do
autoload "$function"
done

# Completion -----------------------------------------------------------------
autoload -U compinit && compinit
compdef g=git

# Bindings -------------------------------------------------------------------
bindkey -e
Expand All @@ -22,7 +29,6 @@ bindkey -e
setopt prompt_subst
autoload -Uz vcs_info

# colors:
# red: 1, 9
# green: 2, 10
# yellow: 3, 11
Expand All @@ -37,79 +43,33 @@ zstyle ':vcs_info:*' actionformats '(%b) '
zstyle ':vcs_info:*' formats '(%b) '
zstyle ':vcs_info:*' enable git

# Jobs
export PS1="%1(j.%F{13}%jj%f .)"

# Username and hostname displayed in an SSH session
export PS1="$PS1${SSH_CONNECTION+"%F{2}%n%f@%F{6}%m%f "}"

# Current directory
export PS1="$PS1%F{12}%~%f "

# Current VCS branch
export PS1="$PS1${vcs_info_msg_0_}"

# Prompt is red when previous command didn't exit with 0
export PS1="$PS1%(?.%(!.#.❯).%F{1}%(!.#.❯)%f) "

# Scripts and functions ------------------------------------------------------
. $HOME/bin/z.sh

function precmd() {
vcs_info
print -Pn "\e];%~\a"
}

function chpwd() {
ls -Ft | head -8;
}

function va() {
. "$VIRTUALENV_BASE/$1/bin/activate"
}

function vn() {
virtualenv "$VIRTUALENV_BASE/$1"
}

function bm() {
alias $1="cd $PWD"
}
function set_prompt() {
# Jobs
export PS1="%1(j.%F{13}%jj%f .)"

function voc() {
echo "$1" >> $HOME/notes/vocabulary.txt
}
# Username and hostname displayed in an SSH session
export PS1="$PS1${SSH_CONNECTION+"%F{2}%n%f@%F{6}%m%f "}"

function mkcd() {
mkdir -pv "$1" && cd "$1";
}
# Current directory
export PS1="$PS1%F{12}%~%f "

function http() {
curl http://httpcode.info/$1;
}
# Current VCS branch
export PS1="$PS1${vcs_info_msg_0_}"

function ff() {
ls "**/*$1*"
# Prompt is red when previous command didn't exit with 0
export PS1="$PS1%(?.%(!.#.❯).%F{1}%(!.#.❯)%f) "
}

function e() {
if [ $# -eq 0 ]; then
$EDITOR .
else
$EDITOR "$@"
fi
}

function g() {
if [ $# -ne 0 ]; then
git $@
else
git status
fi
}
compdef g=git
# Scripts --------------------------------------------------------------------
. $HOME/bin/z.sh

# Aliases --------------------------------------------------------------------
alias v="virtualenv"
alias m="mutt"
alias o="offlineimap"
alias h="history"
alias x="chmod u+x"
alias j="z"
alias c="cd"
alias ..="cd .."
alias ...="cd ../.."
Expand All @@ -118,16 +78,11 @@ alias .....="cd ../../../.."
alias l="ls -F"
alias ll="ls -Fl"
alias la="ls -FlA"
alias ld="ls -d */"
alias l.="ls -d .*"
alias ld="ls -ld */"
alias l.="ls -ld .*"
alias lb="ranger"
alias mk="mkdir -p"
alias x="chmod a+x"
alias t="tmux"
alias tn="tmux new -s"
alias ta="tmux attach -t"
alias tl="tmux list-sessions"
alias h="history"
alias j="jobs"
alias v="virtualenv"
alias m="mutt"
alias mk="mkdir -p"

0 comments on commit d3e47c4

Please sign in to comment.