update to view nothing as a text file

This commit is contained in:
jowj 2018-04-28 21:05:09 -05:00
parent c507eb2e0f
commit b713a13983
2 changed files with 171 additions and 2 deletions

169
.bashrc Normal file
View File

@ -0,0 +1,169 @@
#!/bin/bash
# glob filenames case-insensitively
shopt -s nocaseglob
# append history to history file, don't overwrite.
shopt -s histappend
# fix line wrap issues
shopt -s checkwinsize
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# blatantly steal micah's ls aliases because they make SO MUCH SENSE omg.
alias lsa='ls -a'
alias lsl='ls -a -l'
alias lsli='lsl -i' # lsl+inodes
alias l1='ls -1'
alias llm='lsl -r -t' # lsl+ sort by modified time (lastest at bottom)
# blatantly steal micah's colorized man pages
# See: http://boredzo.org/blog/archives/2016-08-15/colorized-man-pages-understood-and-customized
# see: https://github.com/mrled/dhd/blob/800544cae0cc2f4e2b85b5dafae59babf75677fe/hbase/.bashrc
man() {
env \
LESS_TERMCAP_md=$'\e[1;36m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[1;40;92m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[1;32m' \
man "$@"
}
# history control variables
export HISTCONTROL=ignoreboth
export HISTSIZE="INFINITE"
export HISTFILESIZE=5000
export HISTCONTROL="ignorespace"
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
# If set, the pattern "**" used in a pathname expansion context will
# 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)"
# set variable identifying the chroot you work in (used in the prompt below)
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
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
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
ansi_reset=$(ansi mode=reset)
ansi_bold=$(ansi mode=bold)
ansi_fg_white=$(ansi fg=white)
ansi_fg_green=$(ansi fg=green)
ansi_fg_gray=$(ansi mode=unbold fg=white)
ansi_fg_red=$(ansi fg=red)
ansi_fg_blue=$(ansi fg=blue)
ansi_fg_magenta=$(ansi fg=magenta)
bashprompt() {
# Gather the exit code first, in case something resets it
exitcoderaw="$?"
# Save the shell's history
history -a
# Reset any previous settings, in case last output did not
init="\[${ansi_reset}\]"
dateraw='\t'
date="\[${ansi_bold}${ansi_fg_white}\]${dateraw}\[${ansi_reset}\]"
if test "$exitcoderaw" -eq 0 || test -z "$exitcoderaw"; then
# Covers a case where no command has been previously executed
exitcoderaw=0
exitcodecolor="$ansi_fg_gray"
else
exitcodecolor="$ansi_fg_red"
fi
exitcode="\[${exitcodecolor}\]E${exitcoderaw}\[${ansi_reset}\]"
# Allow setting PROMPT_HOSTNAME_OVERRIDE for situations where the hostname
# is not a useful way to identify the host
# For instance, the hostname may be automatically generated by Docker
hostnameraw="${PROMPT_HOSTNAME_OVERRIDE:-"\\h"}"
hostname="\[${ansi_bold}${ansi_fg_blue}\]$hostnameraw\[$ansi_reset\]"
jobcountraw=$(jobs | wc -l | sed 's/ *//g')
if test "$jobcountraw" -gt 0 2> /dev/null; then
jobcountcolor="$ansi_fg_magenta"
else
jobcountcolor="$ansi_fg_gray"
fi
jobcount="\[${jobcountcolor}\]J${jobcountraw}\[${ansi_reset}\]"
workdirraw='\W'
workdir="\[${ansi_fg_green}\]${workdirraw}\[${ansi_reset}\]"
# lcop = last character of prompt
# Use bash's $EUID variable to avoid having to shell out to 'id'
lcopraw='>'
if test "$EUID" -eq 0; then
lcopraw='#'
fi
lcop="\[${ansi_bold}${ansi_fg_blue}\]${lcopraw}\[${ansi_reset}\]"
export PS1="${init}${date} ${exitcode} ${hostname} ${jobcount} ${workdir} ${lcop} "
}
export PROMPT_COMMAND=bashprompt
if test -d "$HOME/.bashrc.d"; then
for script in $(find "$HOME/.bashrc.d" -type f); do
. "$script"
done
fi

4
.gitattributes vendored
View File

@ -1,2 +1,2 @@
# set default behavior for line endings
text eol=lf
# set default behavior for line endings
* -text