Created
October 4, 2017 14:32
-
-
Save petele/000830e3ba58b47b2b487ac9566867b3 to your computer and use it in GitHub Desktop.
My dotfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make ls in color | |
alias ls="command ls -G" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Hello $USER." | |
for file in ~/.{profile,bash_prompt,exports,aliases,functions}; do | |
[ -r "$file" ] && source "$file" | |
done | |
unset file | |
# Case insensitive globbing | |
shopt -s nocaseglob | |
# Append to bash history | |
shopt -s histappend | |
# Autocorrect typos in path names | |
shopt -s cdspell | |
# Increate the number of files opened | |
ulimit -n 4096 | |
#launchctl limit maxfiles 10480 10480 | |
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards | |
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh | |
# Add tab completion for `defaults read|write NSGlobalDomain` | |
# You could just use `-g` instead, but I like being explicit | |
complete -W "NSGlobalDomain" defaults | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
# The next line updates PATH for the Google Cloud SDK. | |
if [ -f '/Users/petele/google-cloud-sdk/path.bash.inc' ]; then source '/Users/petele/google-cloud-sdk/path.bash.inc'; fi | |
# The next line enables shell command completion for gcloud. | |
if [ -f '/Users/petele/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/petele/google-cloud-sdk/completion.bash.inc'; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt” | |
# Shamelessly copied from https://github.com/gf3/dotfiles | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi | |
if tput setaf 1 &> /dev/null; then | |
tput sgr0 | |
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then | |
MAGENTA=$(tput setaf 9) | |
ORANGE=$(tput setaf 172) | |
GREEN=$(tput setaf 190) | |
PURPLE=$(tput setaf 141) | |
WHITE=$(tput setaf 256) | |
else | |
MAGENTA=$(tput setaf 5) | |
ORANGE=$(tput setaf 4) | |
GREEN=$(tput setaf 2) | |
PURPLE=$(tput setaf 1) | |
WHITE=$(tput setaf 7) | |
fi | |
BOLD=$(tput bold) | |
RESET=$(tput sgr0) | |
else | |
MAGENTA="\033[1;31m" | |
ORANGE="\033[1;33m" | |
GREEN="\033[1;32m" | |
PURPLE="\033[1;35m" | |
WHITE="\033[1;37m" | |
BOLD="" | |
RESET="\033[m" | |
fi | |
HOST_COLOR=$ORANGE | |
function git_info() { | |
# check if we're in a git repo | |
git rev-parse --is-inside-work-tree &>/dev/null || return | |
# quickest check for what branch we're on | |
branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') | |
# check if it's dirty (via github.com/sindresorhus/pure) | |
dirty=$(git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ]&& echo -e "*") | |
echo $WHITE" on "$PURPLE$branch$dirty | |
} | |
# Only show username/host if not default | |
function usernamehost() { | |
echo "$USER@${HOST_COLOR}$HOSTNAME " | |
} | |
# iTerm Tab and Title Customization and prompt customization | |
# http://sage.ucsc.edu/xtal/iterm_tab_customization.html | |
# Put the string " [bash] hostname::/full/directory/path" | |
# in the title bar using the command sequence | |
# \[\e]2;[bash] \h::\]$PWD\[\a\] | |
# Put the penultimate and current directory | |
# in the iterm tab | |
# \[\e]1;\]$(basename $(dirname $PWD))/\W\[\a\] | |
PS1="\[\e]2;$PWD\[\a\]\[\e]1;\]$(basename "$(dirname "$PWD")")/\W\[\a\]${BOLD}\$(usernamehost)\[$GREEN\]\w\$(git_info)\[$WHITE\]\n\$ \[$RESET\]" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Global stuff | |
export PATH=$HOME/bin:$PATH | |
export EDITOR="open -a Sublime\ Text" | |
# Prefer US English and use UTF-8 | |
export LC_ALL="en_US.UTF-8" | |
export LANG="en_US" | |
# Don’t clear the screen after quitting a manual page | |
export MANPAGER="less -X" | |
export GOPATH=/Users/petele/Sites/Go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make Tab autocomplete regardless of filename case | |
set completion-ignore-case on | |
# List all matches in case multiple possible completions are possible | |
set show-all-if-ambiguous on | |
# Immediately add a trailing slash when autocompleting symlinks to directories | |
set mark-symlinked-directories on | |
# Use the text that has already been typed as the prefix for searching through | |
# commands (i.e. more intelligent Up/Down behavior) | |
"\e[B": history-search-forward | |
"\e[A": history-search-backward | |
# Do not autocomplete hidden files unless the pattern explicitly begins with a dot | |
set match-hidden-files off | |
# Show all autocomplete results at once | |
set page-completions off | |
# If there are more than 200 possible completions for a word, ask to show them all | |
set completion-query-items 200 | |
# Show extra file information when completing, like `ls -F` does | |
set visible-stats on | |
# Be more intelligent when autocompleting by also looking at the text after | |
# the cursor. For example, when the current line is "cd ~/src/mozil", and | |
# the cursor is on the "z", pressing Tab will not autocomplete it to "cd | |
# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the | |
# Readline used by Bash 4.) | |
set skip-completed-text on | |
# Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' | |
set input-meta on | |
set output-meta on | |
set convert-meta off | |
# Use Alt/Meta + Delete to delete the preceding word | |
"\e[3;3~": kill-word |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment