Permalink
Browse files

fish config and stuff

  • Loading branch information...
1 parent 26118d4 commit 1fdf589a5856400a00e1129bba3d65614ed07e80 @myfreeweb committed Jul 31, 2012
Showing with 237 additions and 46 deletions.
  1. +5 −4 bin/{startzsh.sh → reattach.sh}
  2. +160 −0 config.fish
  3. +2 −0 install.sh
  4. +20 −21 pythonrc.py
  5. +48 −0 rc
  6. +1 −1 tmux.conf
  7. +1 −20 zshrc
@@ -1,14 +1,15 @@
-#!/usr/bin/env zsh
+#!/usr/bin/env bash
# This came from Greg V's dotfiles:
# https://github.com/myfreeweb/dotfiles
# Feel free to steal it, but attribution is nice
if [[ $(uname) == 'Darwin' ]]; then
+ export PATH=$PATH:$(cat ~/.dotfiles_location)/bin/tmux-osx-paste-fix
if [[ -e $(which reattach-to-user-namespace) ]]; then
- reattach-to-user-namespace -l zsh
+ reattach-to-user-namespace -l $1
else
echo 'install reattach-to-user-namespace!'
- zsh
+ $1
fi
else
- zsh
+ $1
fi
View
@@ -0,0 +1,160 @@
+# This came from Greg V's dotfiles:
+# https://github.com/myfreeweb/dotfiles
+# Feel free to steal it, but attribution is nice
+#
+# thanks:
+# https://bitbucket.org/sjl/dotfiles/src/cbbbc897e9b3/fish/config.fish
+# http://selena.deckelmann.usesthis.com/
+# http://coderseye.com/2010/using-virtualenv-with-fish-shell.html
+
+# Setting env {{{
+set CODEDIR $HOME/Code
+if test -s $HOME/.dotfiles_location
+ set DOTFILES (cat $HOME/.dotfiles_location)
+else
+ set DOTFILES $CODEDIR/dotfiles
+ echo "~/.dotfiles_location not found, reinstall dotfiles"
+end
+
+set PATH "/usr/local/bin" $PATH
+set PATH "/usr/local/sbin" $PATH
+for dir in $DOTFILES/bin/*/
+ set PATH $dir $PATH
+end
+set PATH "$DOTFILES/bin" $PATH
+
+# Python
+set -gx PYTHONPATH "/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
+set -gx PYTHONDONTWRITEBYTECODE true
+set -gx VIRTUALENV_DISTRIBUTE true
+set -gx PIP_USE_MIRRORS true
+set -gx PYTHONSTARTUP "$DOTFILES/pythonrc.py"
+set -gx WORKON_HOME "$CODEDIR"
+
+# Ruby
+set PATH "$HOME/.rbenv/bin" $PATH
+set PATH "$HOME/.rbenv/shims" $PATH
+rbenv rehash 2>/dev/null
+
+# Java
+set -gx JAVA_HOME "/Library/Java/Home"
+
+# Fish
+set -gx fish_greeting ''
+set -gx COMMAND_MODE unix2003
+
+# Less
+set -gx LESS_TERMCAP_mb '\E[01;31m'
+set -gx LESS_TERMCAP_me '\E[0m'
+set -gx LESS_TERMCAP_se '\E[0m'
+set -gx LESS_TERMCAP_so '\E[38;5;246m'
+set -gx LESS_TERMCAP_ue '\E[0m'
+set -gx LESS_TERMCAP_us '\E[04;33;146m'
+set -gx LESS "-R"
+
+# Generic settings
+set -gx CLICOLOR "yes"
+set -gx EDITOR "vim"
+set -gx PAGER "less"
+set -gx LANG "en_US.UTF-8"
+set -gx LC_ALL "en_US.UTF-8"
+set -gx LEDGER_FILE "$HOME/Documents/my.ledger"
+# }}}
+
+# Functions {{{
+. $DOTFILES/rc
+
+function mcd
+ mkdir -p "$argv"
+ cd "$argv"
+end
+
+function latrus
+ echo "$argv" | tr "qwertyuiop[]asdfghjkl;'zxcvbnm,.QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM" "йцукенгшщзхъфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ"
+end
+
+function ruslat
+ echo "$argv" | tr "йцукенгшщзхъфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ" "qwertyuiop[]asdfghjkl;'zxcvbnm,.QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM"
+end
+
+# Virtualenv
+function workon -d "Activate virtual environment in $WORKON_HOME"
+ set tgt {$WORKON_HOME}/$argv[1]
+
+ if [ ! -d $tgt ]
+ mkdir -p "$WORKON_HOME"
+ virtualenv $tgt/venv
+ end
+
+ if [ -d $tgt ]
+ cd $tgt
+
+ deactivate
+
+ set -gx VIRTUAL_ENV "$tgt/venv"
+ set -gx _OLD_VIRTUAL_PATH $PATH
+ set -gx PATH "$VIRTUAL_ENV/bin" $PATH
+
+ # unset PYTHONHOME if set
+ if set -q PYTHONHOME
+ set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
+ set -e PYTHONHOME
+ end
+
+ echo "activated $tgt"
+ else
+ echo "$tgt not found"
+ end
+end
+
+complete -c workon -a "(cd $WORKON_HOME; ls -d *)"
+
+function deactivate -d "Exit virtualenv and return to normal shell environment"
+ # reset old environment variables
+ if test -n "$_OLD_VIRTUAL_PATH"
+ set -gx PATH $_OLD_VIRTUAL_PATH
+ set -e _OLD_VIRTUAL_PATH
+ end
+ if test -n "$_OLD_VIRTUAL_PYTHONHOME"
+ set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
+ set -e _OLD_VIRTUAL_PYTHONHOME
+ end
+ set -e VIRTUAL_ENV
+end
+# }}}
+
+# Prompt {{{
+function fish_prompt
+ set last_status $status
+ echo
+
+ set_color black
+ printf '%s' (prompt_pwd)
+ set_color normal
+
+ if git rev-parse --show-toplevel >/dev/null 2>&1
+ set_color normal
+ printf ' on '
+ set_color magenta
+ printf '%s' (git branch --contains HEAD ^/dev/null | grep '*' | tr -s ' ' | cut -d ' ' -f2)
+ set_color normal
+ end
+
+ if [ -n "$VIRTUAL_ENV" ]
+ set_color cyan
+ printf ' (%s)' (basename "$VIRTUAL_ENV")
+ set_color normal
+ end
+ if test $last_status -eq 0
+ set_color green -o
+ printf ' :) '
+ else
+ set_color red -o
+ printf ' [%d] :( ' $last_status
+ end
+end
+# }}}
+
+if status --is-interactive
+ command fortune -s | cowsay -n | lolcat
+end
View
@@ -37,6 +37,8 @@ link mutt
link_custom mutt/muttrc $HOME/.muttrc
link_custom irbrc.rb $HOME/.irbrc
+mkdir -p $HOME/.config/fish
+link_custom config.fish $HOME/.config/fish/config.fish
mkdir -p $HOME/.ssh
link_custom ssh_config $HOME/.ssh/config
mkdir -p $HOME/.lein
View
@@ -38,28 +38,27 @@ def highlight(source):
pager.communicate(highlight(source))
pager.wait()
-if not "bpython" in os.environ["_"]:
+try:
+ class TabCompleter(rlcompleter.Completer):
+ """Completer that supports indenting"""
+ def complete(self, text, state):
+ if not text:
+ return (' ', None)[state]
+ else:
+ return rlcompleter.Completer.complete(self, text, state)
+ readline.set_completer(TabCompleter().complete)
+ readline.set_history_length(1000)
+ if 'libedit' in readline.__doc__:
+ readline.parse_and_bind("bind '\t' rl_complete")
+ else:
+ readline.parse_and_bind(open("%s/.inputrc" % home).read())
+ HISTFILE = "%s/.pyhistory." % home
try:
- class TabCompleter(rlcompleter.Completer):
- """Completer that supports indenting"""
- def complete(self, text, state):
- if not text:
- return (' ', None)[state]
- else:
- return rlcompleter.Completer.complete(self, text, state)
- readline.set_completer(TabCompleter().complete)
- readline.set_history_length(1000)
- if 'libedit' in readline.__doc__:
- readline.parse_and_bind("bind '\t' rl_complete")
- else:
- readline.parse_and_bind(open("%s/.inputrc" % home).read())
- HISTFILE = "%s/.pyhistory." % home
- try:
- readline.read_history_file(HISTFILE)
- except: pass
- atexit.register(readline.write_history_file, HISTFILE)
- except:
- print >>sys.stderr, "Couldn't get rlcompleter + readline working."
+ readline.read_history_file(HISTFILE)
+ except: pass
+ atexit.register(readline.write_history_file, HISTFILE)
+except:
+ print >>sys.stderr, "Couldn't get rlcompleter + readline working."
if "DJANGO_SETTINGS_MODULE" in os.environ:
from django.db.models.loading import get_models
View
48 rc
@@ -0,0 +1,48 @@
+# This came from Greg V's dotfiles:
+# https://github.com/myfreeweb/dotfiles
+# Feel free to steal it, but attribution is nice
+#
+# thanks:
+# https://bitbucket.org/sjl/dotfiles/src/cbbbc897e9b3/fish/config.fish
+
+alias b="bundle"
+alias be="bundle exec"
+alias ci="git commit -am"
+alias g="git"
+alias gaes="dev_appserver.py -a 0.0.0.0 ."
+alias gi="gem install"
+alias iaw="open -a 'iA Writer'"
+alias l="ls"
+alias p="popd"
+alias r="rails"
+alias vi="vim"
+alias e="vim" # ;e -- semicolon gets eaten
+alias v="fasd -e vim"
+alias collapse="sed -e 's/ */ /g'"
+alias P="$PAGER"
+alias ele="$EDITOR $LEDGER_FILE"
+alias ass="ledger -s bal Assets"
+alias pipup="pip freeze --local | cut -d = -f 1 | xargs pip install -U"
+alias pipfr="pip freeze --local > requirements.txt"
+alias emacs="TERM=xterm-256color emacs"
+alias ..="cd .."
+alias ...="cd ../.."
+alias ....="cd ../../.."
+alias .....="cd ../../../.."
+alias l1="tree --dirsfirst -ChFL 1"
+alias l2="tree --dirsfirst -ChFL 2"
+alias l3="tree --dirsfirst -ChFL 3"
+alias l4="tree --dirsfirst -ChFL 4"
+alias l5="tree --dirsfirst -ChFL 5"
+alias ll1="tree --dirsfirst -ChFupDaL 1"
+alias ll2="tree --dirsfirst -ChFupDaL 2"
+alias ll3="tree --dirsfirst -ChFupDaL 3"
+alias ll4="tree --dirsfirst -ChFupDaL 4"
+alias ll5="tree --dirsfirst -ChFupDaL 5"
+alias l="l1"
+alias ll="ll1"
+alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
+alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
+alias s_http="python -m SimpleHTTPServer"
+alias s_smtp="python -m smtpd -n -c DebuggingServer localhost:1025"
+alias pinst="sudo python setup.py install; and sudo rm -r build dist *egg-info"
View
@@ -58,7 +58,7 @@ set -g set-titles-string "tmux.#I.#W"
set -g base-index 1
set -s escape-time 0
setw -g aggressive-resize on
-set -g default-command "zsh ~/Code/dotfiles/bin/startzsh.sh"
+set -g default-command "sh ~/Code/dotfiles/bin/reattach.sh $SHELL"
set -g default-terminal "screen-256color"
set -ga update-environment " SOLARIZED"
set -g history-limit 50000
View
21 zshrc
@@ -64,28 +64,9 @@ if [[ $IS_MAC == 1 ]]; then
fi
# }}}
# Custom settings, aliases and functions {{{
-alias b="bundle"
-alias be="bundle exec"
-alias ci="git commit -am"
-alias g="git"
-alias gaes="dev_appserver.py -a 0.0.0.0 ."
-alias gi="gem install"
-alias iaw="open -a 'iA Writer'"
-alias l="ls"
-alias p="popd"
-alias r="rails"
-alias vi="vim"
-alias e="vim" # ;e -- semicolon gets eaten
-alias v="fasd -e vim"
-alias collapse="sed -e 's/ */ /g'"
+source $DOTFILES/rc
psack() { ps auxww | ack $* | ack -v ack | collapse | cut -d' ' -f 2,11- }
alias "ps?"=psack
-alias P="$PAGER"
-alias ele="$EDITOR $LEDGER_FILE"
-alias ass="ledger -s bal Assets"
-alias pipup="pip freeze --local | cut -d = -f 1 | xargs pip install -U"
-alias pipfr="pip freeze --local > requirements.txt"
-alias emacs="TERM=xterm-256color emacs"
cljv() { curl -s https://clojars.org/$1 | grep version | head -n 1 | sed -e "s/<[a-z\/=\" ]*>//g" -e "s/&lt;[\/a-z]*&gt;//g" }
dighost() { host $(dig $1 | grep ANSWER -C 1 | tail -n 1 | awk '{ print $5 }') }
vidposter() {

0 comments on commit 1fdf589

Please sign in to comment.