Skip to content

Commit

Permalink
add NVM config to bash_profile; aliases review; more comments; other …
Browse files Browse the repository at this point in the history
…minor tweaks
  • Loading branch information
markets committed Jan 14, 2018
1 parent 8431262 commit 7cc7d9d
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 34 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Markets dotfiles [![markets/dotfiles](http://img.shields.io/badge/good-stuff-blue.svg)](https://github.com/markets/dotfiles)
# .dotfiles [![markets/dotfiles](https://img.shields.io/badge/good-stuff-blue.svg?style=flat-square)](https://github.com/markets/dotfiles)

This repository contains some configuration files (Git, Bash, aliases, Ruby, Sublime Text, ...) and some custom scripts/tools to bootstrap a friendly development environment :ok_hand:
This repository contains some configuration files (Git, Bash, aliases, Ruby, Sublime Text, Node, ...) and some custom scripts and tools to bootstrap a friendly macOS development environment :ok_hand:

## Installation

Expand Down Expand Up @@ -44,4 +44,6 @@ Use `~/.secrets` for stuff that you don't want to share in your public, versione

Git credentials are configured via the `~/.secrets` file.

---

Enjoy :metal:
31 changes: 26 additions & 5 deletions bash/bash_aliases
Original file line number Diff line number Diff line change
@@ -1,44 +1,60 @@
# Reload current shell
alias reload='source ~/.bash_profile'

alias q='exit'

# Be polite
alias please='sudo'

alias h='history'
alias hi='history | tail -20'

alias l='ls -laGFh'
# Navigation
alias ..='cd ..'
alias ...='cd ../..'
alias cdd='cd -'

alias projects='cd $PROJECTS'

alias l='ls -laGFh'
alias numfiles='echo $(ls -1 | wc -l)'

# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'

alias psa='ps aux'
alias psg='ps aux | grep $1'

alias ka9='killall -9'
alias k9='kill -9'

alias df='df -h' # humanize sizes
# Print humanized sizes
alias df='df -h'

alias cp='cp -i' # confirm before overwrite
# Confirm before overwrite when copying
alias cp='cp -i'

# Copy public key to clipboard
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to clipboard.'"

# Print hosts file
alias hosts='more /etc/hosts'

# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en1"
alias ips="ifconfig -a | grep -o 'inet6\? \(\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\|[a-fA-F0-9:]\+\)' | sed -e 's/inet6* //'"

alias week='date +%V'
alias day='date +%d'

# Open apps
alias chrome="open -a google\ chrome"
alias safari="open -a safari"
alias firefox="open -a firefox"
alias skype='open -a Skype'
alias mou='open -a Mou'

# Clipboard
alias c='pbcopy'
alias p='pbpaste'

Expand All @@ -48,6 +64,7 @@ alias devlog='tail -f log/development.log'
alias post='curl -i -X POST'
alias get='curl -i -X GET'

# Git
alias gst='git status'
alias gco='git checkout'
alias gd='git diff'
Expand All @@ -73,4 +90,8 @@ alias rr='bundle exec rake routes'
alias rt='bundle exec rake -T --all'

alias jks='jekyll server -w'
alias jkb='jekyll build'
alias jkb='jekyll build'

alias ni='npm install'
alias nu='npm uninstall'
alias nup='npm update'
7 changes: 2 additions & 5 deletions bash/bash_functions
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ function mkcd
mkdir -p $dir && cd $dir;
}

function ips
{
ifconfig | grep "inet " | awk '{ print $2 }'
}

# Set title for current tab
function tabname {
printf "\e]1;$1\a"
}

# Set title for current window
function winname {
printf "\e]2;$1\a"
}
Expand Down
36 changes: 19 additions & 17 deletions bash/bash_profile
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
source ~/.bash_aliases
source ~/.bash_functions

# Git completion
if [ -f $(brew --prefix)/etc/bash_completion.d/git-completion.bash ]; then
source $(brew --prefix)/etc/bash_completion.d/git-completion.bash
fi

# Git prompt
if [ -f $(brew --prefix)/etc/bash_completion.d/git-prompt.sh ]; then
source $(brew --prefix)/etc/bash_completion.d/git-prompt.sh
fi

# Use .secrets for stuff that you don't want to share in your public, versioned repo.
# Use .secrets for stuff that you don't want to share in your public, versioned repo
if [[ -e ~/.secrets ]]; then
source ~/.secrets
fi

# PATH
export PATH="$HOME/.bin:$HOME/.rbenv/bin:/usr/local/bin:$PATH"
export GOPATH=$PROJECTS/golang
export PATH=$PATH:$GOPATH/bin

# Main Editor
export EDITOR="subl -w"

# Grep settings
export GREP_OPTIONS='--color=auto'

# Bash history
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
shopt -s histappend # append to history, don't overwrite it
export HISTSIZE=5000
export HISTFILESIZE=5000

# Evaluate rbenv
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

# Rbenv
eval "$(rbenv init -)"

# Regular colors
RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
CYAN="\[\033[0;36m\]"
# Colors
WHITE="\[\033[0;37m\]"

# Emphasized (bolded) colors
BRED="\[\033[1;31m\]"
BGREEN="\[\033[1;32m\]"
BYELLOW="\[\033[1;33m\]"
BBLUE="\[\033[1;34m\]"
BCYAN="\[\033[1;36m\]"
BWHITE="\[\033[1;37m\]"
BOLD_YELLOW="\[\033[1;33m\]"
BOLD_WHITE="\[\033[1;37m\]"
BOLD_CYAN="\[\033[1;36m\]"
BOLD_RED="\[\033[1;31m\]"

# Prompt style
export PS1="$BYELLOW[\$(ruby_version)]$BWHITE \u: \w$BCYAN\$(__git_ps1)$BRED\$(git_dirty)$WHITE\$ "
export PS1="$BOLD_YELLOW[\$(ruby_version)]$BOLD_WHITE \u: \w$BOLD_CYAN\$(__git_ps1)$BOLD_RED\$(git_dirty)$WHITE\$ "
4 changes: 3 additions & 1 deletion bash/inputrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 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
TAB: menu-complete
1 change: 0 additions & 1 deletion bash/secrets.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Git credentials
export GIT_AUTHOR_NAME="YOUR_GIT_AUTHOR_NAME"
export GIT_AUTHOR_EMAIL="YOUR_GIT_AUTHOR_EMAIL"

export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"

Expand Down
3 changes: 0 additions & 3 deletions bin/webserver
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env ruby

require 'rubygems'
require 'webrick'
require 'optparse'

Expand All @@ -16,7 +15,6 @@ optparse = OptionParser.new do |opts|

options[:docroot] = Dir.pwd
opts.on( '-d', '--doc_root PATH', 'Document Root (default current dir)' ) do |docroot|
puts docroot
options[:docroot] = docroot
end

Expand All @@ -28,7 +26,6 @@ end

optparse.parse!

# run WEBrick
server = WEBrick::HTTPServer.new(
Port: options[:port],
DocumentRoot: options[:docroot]
Expand Down

0 comments on commit 7cc7d9d

Please sign in to comment.