Skip to content

Instantly share code, notes, and snippets.

@cursork
Last active December 11, 2015 20:28
Show Gist options
  • Save cursork/4655639 to your computer and use it in GitHub Desktop.
Save cursork/4655639 to your computer and use it in GitHub Desktop.
alias ls="ls -G -F"
source ~/perl5/perlbrew/etc/bashrc
source ~/perl5/perlbrew/etc/perlbrew-completion.bash
export HISTCONTROL="ignoreboth"
export HISTFILESIZE=25000
export HISTSIZE=25000
shopt -s histappend
shopt -s histverify
export PATH="~/.bin/:$PATH"
export PATH="/usr/local/share/npm/bin/:$PATH"
export EDITOR=vim
export LESSCHARSET=UTF-8
# git branch in prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# And which perl are we using?
function parse_perlbrewed_perl {
local perl=$(perlbrew info | grep activated | sed -e 's/activated: \(.*\)/(\1)/')
if [ "$perl" == "" ]; then
perl='(system perl)'
fi
echo $perl
}
function unicode_success {
if [ "$?" == "0" ]; then
echo -n ''
else
echo -n '⨯ '
fi
}
# export PS1='\[\033[01;32m\]$PWD \[\033[01;34m\]$(parse_perlbrewed_perl)\[\033[01;31m\]$(parse_git_branch)\[\033[01;32m\]\n\[\033[01;35m\]\$ \[\033[00m\]'
source /usr/local/etc/bash_completion
source /usr/local/Cellar/git/1.8.4/etc/bash_completion.d/git-completion.bash
source /usr/local/Cellar/git/1.8.4/etc/bash_completion.d/git-prompt.sh
# $(echo -e "\xC2")\]$(echo -e "\xBB") <-- this is done so line lengths work :(
export PS1='\[\033[5;31m\]$(unicode_success)\[\033[01;30m\]$PWD\[\033[01;31m\]$(__git_ps1)\[\033[01;32m\]\n\[\033[01;35m$(echo -e "\xC2")\]$(echo -e "\xBB") \[\033[00m\]'
# Shamelessly ripped from http://orangesplotch.com/bash-going-up/
# Go up directory tree X number of directories
function up() {
local counter="$@";
# default $counter to 1 if it isn't already set
if [[ -z $counter ]]; then
counter=1
fi
# make sure $counter is a number
if [ $counter -eq $counter 2> /dev/null ]; then
nwd=`pwd` # Set new working directory (nwd) to current directory
# Loop $nwd up directory tree one at a time
until [[ $counter -lt 1 ]]; do
nwd=`dirname $nwd`
let counter-=1
done
cd $nwd # change directories to the new working directory
else
# print usage and return error
echo "usage: up [NUMBER]"
return 1
fi
}
# START tmux completion
# This file is in the public domain
# See: http://www.debian-administration.org/articles/317 for how to write more.
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc
_tmux()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=" \
attach-session \
bind-key \
break-pane \
capture-pane \
choose-client \
choose-session \
choose-window \
clear-history \
clock-mode \
command-prompt \
confirm-before \
copy-buffer \
copy-mode \
delete-buffer \
detach-client \
display-message \
display-panes \
down-pane \
find-window \
has-session \
if-shell \
join-pane \
kill-pane \
kill-server \
kill-session \
kill-window \
last-window \
link-window \
list-buffers \
list-clients \
list-commands \
list-keys \
list-panes \
list-sessions \
list-windows \
load-buffer \
lock-client \
lock-server \
lock-session \
move-window \
new-session \
new-window \
next-layout \
next-window \
paste-buffer \
pipe-pane \
previous-layout \
previous-window \
refresh-client \
rename-session \
rename-window \
resize-pane \
respawn-window \
rotate-window \
run-shell \
save-buffer \
select-layout \
select-pane \
select-prompt \
select-window \
send-keys \
send-prefix \
server-info \
set-buffer \
set-environment \
set-option \
set-window-option \
show-buffer \
show-environment \
show-messages \
show-options \
show-window-options \
source-file \
split-window \
start-server \
suspend-client \
swap-pane \
swap-window \
switch-client \
unbind-key \
unlink-window \
up-pane"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
}
complete -F _tmux tmux
# END tmux completion
source /usr/local/Cellar/z/1.8/etc/profile.d/z.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment