diff --git a/bash/.bash_helpers.sh b/bash/.bash_helpers.sh new file mode 100644 index 0000000..4afc656 --- /dev/null +++ b/bash/.bash_helpers.sh @@ -0,0 +1,55 @@ + +set_prompt() { + local BLUE="\[\e[0;34m\]" + local DARK_BLUE="\[\e[1;34m\]" + local RED="\[\e[0;31m\]" + local DARK_RED="\[\e[1;31m\]" + local GREEN="\[\e[0;32m\]" + local NO_COLOR="\[\e[0m\]" + + case $TERM in + xterm*|screen) + TITLEBAR='\[\e]0;\u@\h \w\007\]'; + ;; + *) + TITLEBAR=""; + ;; + esac + + FAILURE_COLOR="if [[ \$? = '0' ]]; then echo \"$GREEN\"; else echo \"$RED\"; fi" + + PS1="${TITLEBAR}$BLUE[\t]\`$FAILURE_COLOR\` \u@\h> $NO_COLOR" +} + +restart_network_manager() { + sudo service network-manager restart +} + +configure_ls() { + PLATFORM=$(uname) + # makes ls print pretty + case $PLATFORM in + Linux) + alias ls="ls --color=auto" + ;; + *) + alias ls="ls -G" + ;; + esac +} + +configure_completions() { + # If the gcloud sdk is installed, set up completion for it + if [[ -e "$HOME/.install/google-cloud-sdk" ]]; then + source $HOME/.install/google-cloud-sdk/completion.bash.inc + source $HOME/.install/google-cloud-sdk/path.bash.inc + fi + + # If asdf is installed, set up completion for it + if [[ -e "$HOME/.asdf" ]]; then + source $HOME/.asdf/asdf.sh + source $HOME/.asdf/completions/asdf.bash + fi +} + + diff --git a/bash/.bashrc b/bash/.bashrc index 0b9f8cb..839f109 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -7,5 +7,3 @@ then . /etc/bash_completion fi -export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting - diff --git a/bash/.profile b/bash/.profile index df53b55..6d8b46a 100644 --- a/bash/.profile +++ b/bash/.profile @@ -1,45 +1,11 @@ -# PS1="\[\e]0;\@ [\u@\h] [\w]\007\]\[\e[1;33m\]\@ \[\e[1;37m\][\[\e[1;35m\]\u\[\e[1;37m\]@\[\e[1;32m\]\h\[\e[1;37m\]] \[\e[1;37m\][\[\e[1;31m\]\w\[\e[1;37m\]] [\[\e[1;36m\]$(ls -l | grep "^-" | wc -l | tr -d " ") \[\e[1;34m\]files\[\e[1;37m\]] \n\[\e[1;33m\]\@ \[\e[1;37m\]$ \[\e[0m\]" - export SHELL=/bin/bash -update_terminal_cwd() { - true; -} +source ~/.bash_helpers.sh -set_prompt() { - local BLUE="\[\e[0;34m\]" - local DARK_BLUE="\[\e[1;34m\]" - local RED="\[\e[0;31m\]" - local DARK_RED="\[\e[1;31m\]" - local GREEN="\[\e[0;32m\]" - local NO_COLOR="\[\e[0m\]" - - case $TERM in - xterm*|screen) - TITLEBAR='\[\e]0;\u@\h \w\007\]'; - ;; - *) - TITLEBAR=""; - ;; - esac - - FAILURE_COLOR="if [[ \$? = '0' ]]; then echo \"$GREEN\"; else echo \"$RED\"; fi" - - PS1="${TITLEBAR}$BLUE[\t]\`$FAILURE_COLOR\` \u@\h> $NO_COLOR" -} - -restart_network_manager() { - sudo service network-manager restart -} - -# sets the PS1 prompt set_prompt - -# makes ls print pretty -#alias ls="ls --color=auto" -# TODO: make this work on both platforms -alias ls="ls -G" +configure_ls +configure_completions alias notes="vim ~/notes.md" @@ -47,35 +13,30 @@ alias notes="vim ~/notes.md" export EDITOR=vim # set history -export HISTSIZE=1000 -export HISTFILESIZE=1000 -export HISTCONTROL=ignoredups,erasedups -export PROMPT_COMMAND="history -a; $PROMPT_COMMAND" -shopt -s histappend +export HISTSIZE=1000 # very large history +export HISTFILESIZE=10000 # very large history +export HISTCONTROL=ignoreboth:erasedups # ignore duplicate history entries +shopt -s histappend # append to the history when the shell exits (instead of overwriting) # disable messaging if `tty -s`; then mesg n fi -alias href="history -a; history -c; history -r" - export PATH=$PATH:~/.bin -export HISTCONTROL=ignorespace export TERM=xterm-256color -export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 - -source $HOME/.asdf/asdf.sh -source $HOME/.asdf/completions/asdf.bash +# Installed with https://github.com/pyenv/pyenv-installer +eval "$(pyenv init -)" +#eval "$(pyenv virtualenv-init -)" source $HOME/.install/google-cloud-sdk/completion.bash.inc source $HOME/.install/google-cloud-sdk/path.bash.inc alias iex="iex --erl \"-kernel shell_history enabled\"" -eval "$(pyenv init -)" -eval "$(pyenv virtualenv-init -)" - -[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion +if [ -f /usr/local/etc/bash_completion ] +then + . /usr/local/etc/bash_completion +fi diff --git a/config.sh b/config.sh index 20082d0..4b3c650 100755 --- a/config.sh +++ b/config.sh @@ -5,17 +5,5 @@ stow -t ~ screen stow -t ~ vim stow -t ~ slate stow -t ~ iex - -#rm -f .screenrc -#ln -s ~/Code/config/screenrc .screenrc - -#rm -f .vimrc -#ln -s ~/Code/config/vimrc .vimrc - -# set up the default branch for git -#git config --global branch.master.remote origin -#git config --global branch.master.merge refs/heads/master - -#mkdir -f ~/.vim -#git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim +stow -t ~ tmux diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf new file mode 100644 index 0000000..c42f17a --- /dev/null +++ b/tmux/.tmux.conf @@ -0,0 +1,51 @@ +# Reload tmux config +bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." + +set -sg escape-time 0 + +set -g default-terminal "screen-256color" + +# disable automatic window renaming +set-window-option -g automatic-rename on +set-window-option -g allow-rename off + +# window status +setw -g window-status-format "#[bg=colour241,fg=colour233] #I #W " +setw -g window-status-current-format "#[bg=colour245,fg=colour233] #I #W " + +# The statusbar +set -g status-interval 2 +set -g status-position bottom +set -g status-bg colour234 +set -g status-fg colour137 +set -g status-attr dim +set -g status-left '#[fg=colour245] #(whoami)@#H > #S ' +set -g status-right '#[fg=colour233,bg=colour241,bold] %m/%d #[fg=colour233,bg=colour245,bold] %I:%M ' +set -g status-right-length 50 +set -g status-left-length 30 +set -g clock-mode-style 12 + +# Use Alt-vim keys without prefix key to switch panes +bind -n M-h select-pane -L +bind -n M-j select-pane -D +bind -n M-k select-pane -U +bind -n M-l select-pane -R + +# Use Alt-arrow keys without prefix key to switch panes +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +# Window splitting +bind-key c new-window -c "#{pane_current_path}" +bind-key v split-window -h -c "#{pane_current_path}" +bind-key h split-window -v -c "#{pane_current_path}" +bind-key + select-layout even-vertical +bind-key = select-layout even-horizontal + +bind-key -n C-S-Down resize-pane -D 5 +bind-key -n C-S-Up resize-pane -U 5 +bind-key -n C-S-Left resize-pane -L 5 +bind-key -n C-S-Right resize-pane -R 5 + diff --git a/vim/.vim/vimrc b/vim/.vim/vimrc index 20e599d..67ee84f 100644 --- a/vim/.vim/vimrc +++ b/vim/.vim/vimrc @@ -74,6 +74,8 @@ set backupcopy=yes set dir=$HOME/.vim/tmp/swap if !isdirectory(&dir) | call mkdir(&dir, 'p', 0700) | endif +let g:vimwiki_list = [ {'path': '~/Code/ntietz/vimwiki'} ] + set autoread set updatetime=100 au FileChangedShell * checktime