diff --git a/bashhacks/myenv.bash b/bashhacks/myenv.bash new file mode 100644 index 0000000..221f489 --- /dev/null +++ b/bashhacks/myenv.bash @@ -0,0 +1,4 @@ +export PYTHONDONTWRITEBYTECODE=1 +export CLICOLOR=1 +export EDITOR=vim +export LC_ALL="en_US.UTF-8" diff --git a/bashhacks/prompt.bash b/bashhacks/prompt.bash new file mode 100644 index 0000000..102a2b9 --- /dev/null +++ b/bashhacks/prompt.bash @@ -0,0 +1,59 @@ +function _ps_name_and_server { + echo "`whoami`@`hostname -s`" +} + +function _ps_git_branch_and_status { + _GIT_STATUS="`git status --porcelain 2>/dev/null`" + if [ $? -eq 0 ];then + _GIT_DIRTY="" + if [ "$_GIT_STATUS" != "" ];then + _GIT_DIRTY="*" + fi + _GIT_BRANCH="`git branch --no-color | grep '*' | cut -d ' ' -f 2`" + + echo " $_GIT_BRANCH$_GIT_DIRTY" + else + echo "" + fi +} + +function _ps_virtual_env { + if [ "$VIRTUAL_ENV" != "" ];then + echo " `basename $VIRTUAL_ENV`" + fi +} + +function _ps_prompt { + # regular colors + local K="\[\033[0;30m\]" # black + local R="\[\033[0;31m\]" # red + local G="\[\033[0;32m\]" # green + local Y="\[\033[0;33m\]" # yellow + local B="\[\033[0;34m\]" # blue + local M="\[\033[0;35m\]" # magenta + local C="\[\033[0;36m\]" # cyan + local W="\[\033[0;37m\]" # white + + # emphasized (bolded) colors + local BK="\[\033[1;30m\]" + local BR="\[\033[1;31m\]" + local BG="\[\033[1;32m\]" + local BY="\[\033[1;33m\]" + local BB="\[\033[1;34m\]" + local BM="\[\033[1;35m\]" + local BC="\[\033[1;36m\]" + local BW="\[\033[1;37m\]" + + # reset + local RESET="\[\033[0;37m\]" + + local HOST="$RESET@$BB\h" + if [ -z "$SSH_CONNECTION" ];then + HOST="" + fi + + echo "$Y\u$HOST $BG\w$C$(_ps_virtual_env)$M$(_ps_git_branch_and_status) $Y\$$RESET " +} + +PS1=$(_ps_prompt) +PROMPT_COMMAND='PS1=$(_ps_prompt)' diff --git a/bashhacks/tmux.bash b/bashhacks/tmux.bash new file mode 100644 index 0000000..e993f85 --- /dev/null +++ b/bashhacks/tmux.bash @@ -0,0 +1,11 @@ +alias dtmux="direnv exec / tmux" + +function tm { + if [ "$1" == "" ];then + _TM_SESSION="tmdefault" + else + _TM_SESSION=$1 + fi + + dtmux attach -t $_TM_SESSION 2>/dev/null || dtmux new -s $_TM_SESSION +} diff --git a/editorconfig b/editorconfig new file mode 100644 index 0000000..214329d --- /dev/null +++ b/editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +insert_final_newline = true + +[*.mustache] +indent_size = 2 + +[{Makefile,**.mk,rules}] +indent_style = tab +tab_size = 4 + +[*.tx,*.tsx] +indent_size = 2 diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 0000000..a3056f5 --- /dev/null +++ b/tmux.conf @@ -0,0 +1,22 @@ +# Setting prefix to C-a +set -g prefix C-a +bind C-a send-prefix +bind-key a send-prefix +unbind-key C-o + +# Setting escape delay to 0 (for vim) +set -s escape-time 0 + +# Setting window indexing to start from 1 +set -g base-index 1 +setw -g pane-base-index 1 + +set -g default-terminal "screen-256color" + +setw -g automatic-rename on +set -g set-titles on + +bind-key - split-window -v +bind-key \\ split-window -h + +bind-key o command-prompt -p index "select-pane -t '%%'"