restructuring
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
# Common Aliases
|
||||
# These will be sourced into the main *sh config that's loaded
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -Alh'
|
||||
alias l='ls -C'
|
||||
alias ld='ls -ld'
|
||||
alias lo='ls -lh | sed -e 's/--x/1/g' -e 's/-w-/2/g' -e 's/-wx/3/g' -e 's/r--/4/g' -e 's/r-x/5/g' -e 's/rw-/6/g' -e 's/rwx/7/g' -e 's/---/0/g''
|
||||
alias back='cd $OLDPWD'
|
||||
alias clkear='clear'
|
||||
alias ckear='clear'
|
||||
alias reload='source ~/.zshrc'
|
||||
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
|
||||
alias ipa='ip addr|grep inet'
|
||||
alias cls='clear;ls'
|
||||
alias rvi='sudo -E vim'
|
||||
alias ta='tmux attach -t C0DE || tmux new -s C0DE'
|
||||
alias open='xdg-open'
|
||||
|
||||
|
||||
# Use `shred` if it exists, or just `rm -P`
|
||||
type "$shred" > /dev/null || alias shred='rm -P'
|
96
shell/bashrc
96
shell/bashrc
@@ -1,96 +0,0 @@
|
||||
# Include our shared environment stuff
|
||||
source ~/dotfiles/shell/env
|
||||
source ~/dotfiles/shell/aliases
|
||||
source ~/dotfiles/shell/functions
|
||||
|
||||
# Basic options
|
||||
export HISTCONTROL=ignoredups
|
||||
export COLORFGBG='default;default'
|
||||
|
||||
export LESS_TERMCAP_mb=$'\E[01;31m'
|
||||
export LESS_TERMCAP_md=$'\E[01;31m'
|
||||
export LESS_TERMCAP_me=$'\E[0m'
|
||||
export LESS_TERMCAP_se=$'\E[0m'
|
||||
export LESS_TERMCAP_so=$'\E[01;44;33m'
|
||||
export LESS_TERMCAP_ue=$'\E[0m'
|
||||
export LESS_TERMCAP_us=$'\E[01;32m'
|
||||
|
||||
shopt -s checkwinsize
|
||||
eval "$(dircolors -b /etc/dircolors)"
|
||||
|
||||
|
||||
# X Terminal titles
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Bash completion
|
||||
if [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
|
||||
echo "appending a '&' on the back of commands will run them in the background"
|
||||
echo "Don't forget ^s to pause commands and ^q to resume paused commands"
|
||||
|
||||
function timer_start {
|
||||
timer=${timer:-$SECONDS}
|
||||
}
|
||||
|
||||
function timer_stop {
|
||||
timer_show=$(($SECONDS - $timer))
|
||||
unset timer
|
||||
}
|
||||
|
||||
trap 'timer_start' DEBUG
|
||||
PROMPT_COMMAND=timer_stop
|
||||
|
||||
# Prompt
|
||||
# Black 0;30 Dark Gray 1;30
|
||||
# Blue 0;34 Light Blue 1;34
|
||||
# Green 0;32 Light Green 1;32
|
||||
# Cyan 0;36 Light Cyan 1;36
|
||||
# Red 0;31 Light Red 1;31
|
||||
# Purple 0;35 Light Purple 1;35
|
||||
# Brown 0;33 Yellow 1;33
|
||||
# Light Gray 0;37 White 1;37
|
||||
|
||||
BLACK='\[\033[0;30m\]'
|
||||
BLUE='\[\033[0;34m\]'
|
||||
GREEN='\[\033[0;32m\]'
|
||||
CYAN='\[\033[0;36m\]'
|
||||
RED='\[\033[0;31m\]'
|
||||
PURPLE='\[\033[0;35m\]'
|
||||
BROWN='\[\033[0;33m\]'
|
||||
LGRAY='\[\033[0;37m\]'
|
||||
DGRAY='\[\033[1;30m\]'
|
||||
LBLUE='\[\033[1;34m\]'
|
||||
LGREEN='\[\033[1;32m\]'
|
||||
LCYAN='\[\033[1;36m\]'
|
||||
LRED='\[\033[1;31m\]'
|
||||
LPURPLE='\[\033[1;35m\]'
|
||||
YELLOW='\[\033[1;33m\]'
|
||||
WHITE='\[\033[1;37m\]'
|
||||
|
||||
RBG='\e[41m'
|
||||
ALERT=${WHITE}${RBG} # Bold White on red background
|
||||
NC="\e[m" # Color Reset
|
||||
|
||||
PS1="\[\033]0;Bash | \u@\H:\w\007\]" # Add a dynamically changing window title - Shows current user@host:current directory (comment this and "$PS1" at beginning of next line when not an a terminal emulator)
|
||||
PS1="$PS1""${LGREEN}[${LPURPLE}\u${WHITE}@${LBLUE}\h${LGREEN}]-(${YELLOW}\w${LGREEN})"
|
||||
PS1="$PS1""\n [${LRED}\@ ${LGRAY}Last:${WHITE} \${timer_show}s ${LCYAN}Err:"
|
||||
|
||||
# Error code test - not working
|
||||
#if [[ \$? = "0" ]] # If last program exited with 0 (good exit)
|
||||
#then
|
||||
PS1="$PS1"" ${WHITE}\$?" # show white error code
|
||||
#else
|
||||
# PS1="$PS1"" ${LRED}\$?" # if last program exited with anything else, show red error code
|
||||
#fi
|
||||
|
||||
PS1="$PS1"" ${LPURPLE}BJobs:${PURPLE} \j ${LBLUE}Hist: ${LCYAN}\!${LGREEN}]\n ->${LGRAY} "
|
||||
#PS1="$PS1"" ${NC}"
|
48
shell/env
48
shell/env
@@ -1,48 +0,0 @@
|
||||
# Skip all this for non-interactive shells
|
||||
[[ -z "$PS1" ]] && return
|
||||
|
||||
# Force en_US UTF-8 environment
|
||||
export LC_ALL=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
export LANGUAGE=en_US.UTF-8
|
||||
|
||||
# Terminal Editor
|
||||
export EDITOR=vim
|
||||
|
||||
# Paths
|
||||
export PATH=${HOME}/bin:$PATH:/usr/lib/wine/bin:/sbin:/usr/sbin:/usr/local/bin
|
||||
|
||||
# Give the path to the dotfiles
|
||||
export _DOTFILES="${HOME}/dotfiles"
|
||||
|
||||
# Allow automatic updates
|
||||
export DISABLE_DOTFILES_AUTO_UPDATE="FALSE"
|
||||
|
||||
# Set "true" to update without asking first
|
||||
export DISABLE_DOTFILES_UPDATE_PROMPT="FALSE"
|
||||
|
||||
# Update every 2 weeks (OMZ default)
|
||||
export UPDATE_DOTFILES_DAYS=13
|
||||
|
||||
# Whether or not to automatically connect to a TMUX session when opening the shell
|
||||
export ENABLE_TMUXAC="TRUE"
|
||||
|
||||
# If there is not an active tmux session, we probably want one
|
||||
# Otherwise, the shell will not open the session again (eg. opening tabs, new terminals)
|
||||
if $(tmux list-sessions >> /dev/null 2>&1); then
|
||||
export TMUXATT="TRUE"
|
||||
else
|
||||
export TMUXATT="FALSE"
|
||||
fi
|
||||
|
||||
# Automatically attach tmux session "C0DE"
|
||||
if [[ -z "$TMUX" && "$TMUXATT" != "TRUE" && "$ENABLE_TMUXAC" != "FALSE" ]]; then
|
||||
tmux attach -t C0DE || tmux new -s C0DE
|
||||
fi
|
||||
|
||||
# Enable shell-history for interactive shells
|
||||
# https://github.com/pawamoy/shell-history
|
||||
#if [[ $- == *i* ]] && command -v shellhistory-location &>/dev/null; then
|
||||
# . $(shellhistory-location)
|
||||
# shellhistory enable
|
||||
#fi
|
@@ -1,78 +0,0 @@
|
||||
# Functions gathered from around the internet
|
||||
# Takes 1st argument and attempts to extract them in the current directory
|
||||
extract () { # Extracts most common compressed files
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf $1 ;;
|
||||
*.tar.gz) tar xzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) rar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
# Takes 1st argument and makes a .tar.gz archive
|
||||
maketgz() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
|
||||
# Takes 1st argument and makes a .zip archive
|
||||
makezip() { zip -r "${1%%/}.zip" "$1" ; }
|
||||
# Generate password - 1st argument is the number of characters, defaults to 20
|
||||
gpass() {
|
||||
local l=$1
|
||||
[ "$l" == "" ] && l=20
|
||||
tr -dc A-Za-z0-9-!@%^*_ < /dev/urandom | head -c ${l} | xargs
|
||||
}
|
||||
# Shows the current PS list for the signed in user - Not cygwin compatible
|
||||
myps() { ps $@ -u $USER -o pid,%cpu,%mem,bsdtime,command ; }
|
||||
# Searches the process list (ps) for 1st argument
|
||||
psgrep() {
|
||||
if [ ! -z $1 ] ; then
|
||||
echo "Grepping for processes matching $1..."
|
||||
ps aux | grep $1 | grep -v grep
|
||||
else
|
||||
echo "!! Need name to grep for"
|
||||
fi
|
||||
}
|
||||
# dirsize - finds directory sizes and lists them for the current directory
|
||||
dirsize (){
|
||||
du -shx * .[a-zA-Z0-9_]* 2> /dev/null | \
|
||||
egrep '^ *[0-9.]*[MG]' | sort -n > /tmp/list
|
||||
egrep '^ *[0-9.]*M' /tmp/list
|
||||
egrep '^ *[0-9.]*G' /tmp/list
|
||||
rm -rf /tmp/list
|
||||
}
|
||||
# Usage: up <Number of directories>. Blank for up one dir.
|
||||
up() {
|
||||
local d=""
|
||||
limit=$1
|
||||
for ((i=1; i <= limit; i++)); do
|
||||
d=$d/..
|
||||
done
|
||||
d=$(echo $d | sed 's/^\///')
|
||||
if [ -z "$d" ]; then
|
||||
d=..
|
||||
fi
|
||||
cd $d
|
||||
}
|
||||
# Usage: search <regex string>
|
||||
search () {
|
||||
grep -r "$1" | fzf
|
||||
}
|
||||
# Usage: replay <number of commands> to repeat. Blank for 1
|
||||
replay() {
|
||||
from="${1:-2}"
|
||||
to="${2:-1}"
|
||||
if [ "$from" -ne "$to" ]; then
|
||||
for i in `seq "$from" -1 "$(($to + 1))"`; do
|
||||
printf "$(fc -ln -${i} -${i}) && "
|
||||
done
|
||||
fi
|
||||
$(fc -ln -${to} -${to})
|
||||
}
|
81
shell/zshrc
81
shell/zshrc
@@ -1,81 +0,0 @@
|
||||
# Include our shared shell stuff
|
||||
source ~/dotfiles/shell/env
|
||||
source ~/dotfiles/shell/aliases
|
||||
source ~/dotfiles/shell/functions
|
||||
|
||||
# History Settings
|
||||
export HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd:cd ..:cd..:replay"
|
||||
export HISTSIZE=25000
|
||||
export HISTFILE=~/.zsh_history
|
||||
export SAVEHIST=10000
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
setopt HIST_IGNORE_SPACE
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
setopt HIST_VERIFY
|
||||
|
||||
# Say how long a command took, if it took more than 15 seconds
|
||||
export REPORTTIME=15
|
||||
|
||||
# Prompts for confirmation after 'rm *' etc
|
||||
# Helps avoid mistakes like 'rm * o' when 'rm *.o' was intended
|
||||
setopt RM_STAR_WAIT
|
||||
|
||||
# Background processes aren't killed on exit of shell
|
||||
setopt AUTO_CONTINUE
|
||||
|
||||
# Don’t write over existing files with >, use >! instead
|
||||
setopt NOCLOBBER
|
||||
|
||||
# Don’t nice background processes
|
||||
setopt NO_BG_NICE
|
||||
|
||||
# Makes Alt-s insert a sudo at beginning of prompt
|
||||
function insert_sudo {
|
||||
if [[ $BUFFER != "sudo "* ]]; then
|
||||
BUFFER="sudo $BUFFER"; CURSOR+=6
|
||||
fi
|
||||
}
|
||||
zle -N insert-sudo insert_sudo
|
||||
bindkey "^[s" insert-sudo
|
||||
|
||||
# Check for updates...
|
||||
# Stolen and modified Oh-My-ZSH's update system
|
||||
if [ "$DISABLE_DOTFILES_AUTO_UPDATE" != "true" ]; then
|
||||
env ZSH=$ZSH _DOTFILES=$_DOTFILES DISABLE_UPDATE_PROMPT=$DISABLE_DOTFILES_UPDATE_PROMPT zsh -f $_DOTFILES/.bin/check_for_upgrade.sh
|
||||
fi
|
||||
|
||||
# Oh-My-ZSH Options below this line
|
||||
|
||||
# Define Oh-My-ZSH root
|
||||
ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
ZSH_CUSTOM=$_DOTFILES/omz
|
||||
|
||||
# Theme for Oh-My-ZSH
|
||||
ZSH_THEME="darkblood"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
||||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(git \
|
||||
catimg \
|
||||
fancy-ctrl-z \
|
||||
emoji \
|
||||
aws \
|
||||
jsontools \
|
||||
zsh-syntax-highlighting) # zsh-syntax-highlighting must remain the last plugin
|
||||
|
||||
# Load oh-my-zsh
|
||||
source $ZSH/oh-my-zsh.sh
|
Reference in New Issue
Block a user