diff --git a/.bash_aliases b/.bash_aliases index 77a3f9d7055ac4cd6f3915074852b4f0d653277b..daeeb4494293b595e1f612aee2c81cfe8b95d1c4 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -1,4 +1,7 @@ -# .bash_aliases contains aliases for Bash + +################# +# Aliases # +################# # some ls aliases alias ll='ls -alF' @@ -19,14 +22,14 @@ alias -- --='cd -' # Back to last working directory # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' -# Get week number -alias week='date +%V' - # Date/Time aliases alias now='date +%T' alias nowtime=now alias nowdate='date +%m-%d-%Y' +# Get week number +alias week='date +%V' + # IP address alias ip='dig +short myip.opendns.com @resolver1.opendns.com' @@ -38,3 +41,37 @@ alias mv='mv -i' alias cp='cp -i' alias ln='ln -i' +# Make parent directories with mkdir +alias mkdir='mkdir -pv' + +# Continue downloads in case of problems +alias wget='wget -c' + +# Get the size of the current directory, exluding any .git sub-directories +alias dume='du -h --exclude="*.git*" | sort -h' + +# Make free output more human friendly +alias free='free -mt' + + + +################### +# Functions # +################### + +# Count the number of files in a directory and its sub-directories +function count { + find $1 -type f | wc -l +} + +# Show a histogram output of commands in history +function hist { + history | awk '{print $2}' | sort -n | uniq -c | sort -n | tail +} + +# Make a directory, then cd into it +function mcd { + mkdir -pv $1 + cd $1 + pwd +} diff --git a/.bashrc b/.bashrc index d9f58d5d7ee225d54e063d3e0dfe18482416827e..dd1a493bc33bf0af030e868b2f23ce079240dddb 100644 --- a/.bashrc +++ b/.bashrc @@ -24,8 +24,8 @@ HISTFILESIZE=2000 shopt -s checkwinsize # If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar +# # match all files and zero or more directories and subdirectories. +# #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" @@ -35,38 +35,14 @@ if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' -fi -unset color_prompt force_color_prompt +# Set the prompt to '[working directory] $ ' prefixed with the chroot if in chroot +#PS1='${debian_chroot:+($debian_chroot)}[\w] \\$ ' +PS1="${debian_chroot:+($debian_chroot)}[\w] \$ "; -# If this is an xterm set the title to user@host:dir +# If this is an xterm set the title to user@host case "$TERM" in xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h \a\]$PS1" ;; *) ;; @@ -108,7 +84,3 @@ if ! shopt -oq posix; then fi fi -# Handy dandy function to count files in a directory and its subdirectories -function count { - find $1 -type f | wc -l -} diff --git a/.gitconfig b/.gitconfig index 1c9497e7ebf9d553c4f1023d20a6de8b42d1014a..af059a2ed7b1b14b3c98111f74833e4bd0cbbcd9 100644 --- a/.gitconfig +++ b/.gitconfig @@ -3,10 +3,10 @@ email = chris.num2@gmail.com [push] default = simple +[credential] + helper = cache --timeout=43200 [alias] alias = config --get-regexp ^alias\\. stat = status - unstage = reset HEAD -- last = log -1 HEAD -[credential] - helper = cache --timeout=43200 + unstage = reset HEAD -- diff --git a/.vimrc b/.vimrc index 93f6f48831770d33f19eeb037b05248bcf2d2755..eda6354776454befd4e7fd945e488a08ec8fc2a1 100644 --- a/.vimrc +++ b/.vimrc @@ -4,24 +4,30 @@ " Vim configuration resource file. Specifies desired " behavior for the vim editor. " -set showmode " Tell you if you're in insert mode -set tabstop=4 " Set the tabstop to 4 spaces -set shiftwidth=4 " Shiftwidth should match tabstop -set expandtab " Convert tabs to <tabstop> number of spaces -set nowrap " Do not wrap lines longer than the window -set nowrapscan " Do not wrap to the top of the file while searching -set ruler " Show the cursor position all the time -set showmatch " Show matching [] () {} etc... -set smartindent " Let vim help you with your code indention -set nohlsearch " Don't highlight strings you're searching for -set formatoptions+=ro " Automatically insert the comment character when - " you hit <enter> (r) or o/O (o) in a block comment. -set backspace=2 " makes backspace work like you expect -set scrolloff=3 " Minimum number of lines to keep above and below the cursor +:set showmode " Tell you if you're in insert mode +:set tabstop=4 " Set the tabstop to 4 spaces +:set shiftwidth=4 " Shiftwidth should match tabstop +:set expandtab " Convert tabs to <tabstop> number of spaces +:set nowrap " Do not wrap lines longer than the window +:set nowrapscan " Do not wrap to the top of the file while searching +:set ruler " Show the cursor position all the time +:set showmatch " Show matching [] () {} etc... +:set smartindent " Let vim help you with your code indention +:set nohlsearch " Don't highlight strings you're searching for +:set formatoptions+=ro " Automatically insert the comment character when + " you hit <enter> (r) or o/O (o) in a block comment. +:set backspace=2 " makes backspace work like you expect +:set scrolloff=3 " Minimum number of lines to keep above/below the cursor " Switch syntax highlighting on, when the terminal can support colors if &t_Co > 2 || has("gui_running") - syntax on + :syntax on + + " Change the highlight color for Comment and Special + " to Cyan. Blue is too dark for a black background. + ":highlight Comment term=bold ctermfg=cyan guifg=cyan + ":highlight Special term=bold ctermfg=cyan guifg=cyan + ":highlight Constant term=bold ctermfg=red guifg=cyan " If using Putty and solarized doesn't look right, it's because you need " to edit the session colors. If you don't want to do that, then uncomment @@ -36,14 +42,14 @@ endif " Make vim turn *off* expandtab for files named Makefile or makefile " We need the tab literal -autocmd BufNewFile,BufRead [Mm]akefile* set noexpandtab +:autocmd BufNewFile,BufRead [Mm]akefile* set noexpandtab -" Make vim recognize a file ending in ".template" as a C++ source file -autocmd BufNewFile,BufRead *.template set ft=cpp +" Make vim recognize a file ending in ".template" be a C++ source file +:autocmd BufNewFile,BufRead *.template set ft=cpp " Make vim highlight any characters in columns 81+ -"highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white -"match OverLength '\%81v.*' +":highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white +":match OverLength '\%81v.*' " Set the terminal title to reflect the open file. Even works with Vim tabs. -autocmd BufEnter * let &titlestring = expand("%:t") . " - %{$USER}@" . hostname() | set title +:autocmd BufEnter * let &titlestring = expand("%:t") . " - %{$USER}@" . hostname() | set title