dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit 6a016a7737444a286fcbd58954988400969fe24c (patch)
parent e8f413426bca8266ce75274bee8714021dbc99be
Author: Alex Karle <alex@karle.co>
Date:   Tue, 19 Mar 2019 00:16:32 -0400

[bash] major refactor and cleanup; bashrc.local

As I start using bash much more frequently accross multiple machines,
this was the part of my dotfiles breaking down the most.

I needed to make a clear boundary between what could be added to Git,
and what should be local.

This commit:

1) Adds support for a ~/.bashrc.local file which I intend to put all my
   computer-specific and company-internal type stuffs

2) Gets rid of the ~/.bash_exports . I think when I first based my bash
   config off of Mathias Bynens, I took to his modular approach to
   quickly.  In reality, I don't have (and don't anticipate having)
   enough of a config to split it up like he did.

3) Just generally restructures the bashrc code to be cleaner, better
   organized, better documented, and more "me"

Diffstat:
Dbash/bash_exports | 9---------
Mbash/bashrc | 65++++++++++++++++++++++++++++++++++++-----------------------------
2 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/bash/bash_exports b/bash/bash_exports @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# if nvim exists, set it to the editor! -if [ -x "$(command -v nvim)" ]; then - export EDITOR="nvim" - export MANPAGER="nvim -c 'set ft=man' -" -else - export EDITOR="vim" -fi diff --git a/bash/bashrc b/bash/bashrc @@ -1,36 +1,43 @@ #!/usr/bin/env bash +# .bashrc +# The way I like to roll in the shell + # If not running interactively, don't do anything [ -z "$PS1" ] && return # if interactive shell, disable XON/XOFF to allow forward search w CTRL-S [[ $- == *i* ]] && stty -ixon -# Load the shell dotfiles -for file in ~/.bash_{path,prompt,exports}; do - [ -r "$file" ] && source "$file" -done -unset file - -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options -HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=10000 -HISTFILESIZE=20000 - -# ignore certain commands -HISTIGNORE=fg:pwd:ls - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# Git Completion -[ -f ~/.bash/git-completion.bash ] && source ~/.bash/git-completion.bash - -# Source aliases (must go after git completion) -[ -r "$HOME/.aliases" ] && source "$HOME/.aliases" +# History Settings +shopt -s histappend # append to the history file, don't overwrite it +HISTSIZE=10000 # Max lines in history (in memory) +HISTFILESIZE=200000 # Max size of the history file +HISTIGNORE=fg:pwd:ls # Don't store common commands in history +HISTCONTROL=ignoreboth # Don't store (1) duplicate commands in history + # AND don't store lines beginning with space + +# Other Settings +shopt -s checkwinsize # check win size after each cmd, update if needed + +# Custom find function +function ff { + find . -name "*$1*" +} + +# $EDITOR, the most important export of course +if [ -x "$(command -v nvim)" ]; then + export EDITOR="nvim" + export MANPAGER="nvim -u NORC -c 'set ft=man' -" +else + export EDITOR="vim" +fi + +# Source helper files, both mine and other's +function source_if_exists { + [ -r "$1" ] && source "$1" +} + +source_if_exists "$HOME/.bash/git-completion.bash" # Git Completion +source_if_exists "$HOME/.aliases" # Aliases (source after Git Completion!) +source_if_exists "$HOME/.bash_prompt" # Personal Prompt +source_if_exists "$HOME/.bashrc.local" # System specific settings