Code Monkey home page Code Monkey logo

dotfiles's Introduction

Dotfiles

Circle CI Status Patreon

Shell scripts for applying default settings to UNIX-based operating systems.

By default, these are set to my preferences (namely for macOS) but you can change them to your liking by editing any of the *.tt template files in the home_files directory. Read on to learn more.

Table of Contents

Features

  • Configures the Bash .bashrc, .bash_profile, and .inputrc files.
  • Configures the .hushlogin file.
  • Configures the CTags .ctags file.
  • Configures the Vim .vimrc file.
  • Configures the Git .gitconfig, .gitignore, and hook (i.e. .git_template) files.
  • Configures the Silver Surfer .agignore file.
  • Configures the Ruby Gems .gemrc file.
  • Configures the Ruby .ruby-version and .irbrc files.
  • Configures the Pry .pryrc file.
  • Configures the Ruby Debugger .rdebugrc file.
  • Configures the Rails ERD .erdconfig file.
  • Configures the RSpec .rspec file.
  • Configures the Awesome Print .aprc file.
  • Configures the Pow .powconfig file.
  • Configures the PostgreSQL .psqlrc file.
  • Configures the Rubocop .rubocop.yml file.
  • Configures the NPM .npmrc file.
  • Configures Sublime Text as the default editor.
  • Adds Bash Completion.
  • Adds GPG support.
  • Adds Go support.
  • Adds direnv support.
  • Adds chruby support.
  • Adds Node.js support.
  • Adds Travis CI support.
  • Adds Z support.

Screencast

asciicast

Requirements

Setup

Open a terminal window and execute the following commands:

Current Version (stable)

git clone https://github.com/bkuhlmann/dotfiles.git
cd dotfiles
git checkout v27.0.0

Master Version (unstable)

git clone https://github.com/bkuhlmann/dotfiles.git
cd dotfiles

Edit any of the home_files/*.tt template files as you see fit. Then open a terminal window and execute the following command to install:

cd dotfiles
bin/run

Executing the bin/run script will present the following options:

s: Show managed dotfiles.
i: Install dotfiles (existing files are skipped).
l: Link dotfiles to this project (interactive per file, excludes: env.sh and .gitconfig).
c: Check for differences between $HOME files and this project's files.
d: Delete dotfiles (interactive per file, excludes: env.sh and .gitconfig).
q: Quit/Exit.

The options prompt can be skipped by passing the desired option directly to the bin/run script. For example, executing bin/run s will show all managed dotfiles by this project.

After install, the following files will require manual updating:

  • .bash/env.sh: Add secret/machine-specific environment settings (if any).
  • .gitconfig: Uncomment the name, email, and token lines within the [user] and [github] sections to replace with your own details.

Upgrade

When upgrading to a new version, run the following:

  1. Run: bin/run l. This will link any new files. If not using linked files, run bin/run d and bin/run i instead.
  2. Run: bin/run c. This will display file differences (if any -- usually, should only be excluded files).
  3. Run: exec $SHELL. This will apply updates to the current shell.

Usage

Aliases

General

.. = "cd .."
... = "cd ../.."
cdb = "cd -"
c = "clear"
h = "history"
l = "ls -alh"
l1 = "ls -A1 | _copy_and_print '\n'"
p = 'pwd | tr -d "\r\n" | _copy_and_print'
o = "open"
cat = 'ccat -G Keyword = "turquoise" -G Punctuation="green" -G Decimal="green" -G Type="blue" -G Literal="blue" -G String="lightgray" -G Plaintext="white"'
home = 'cd $HOME'
man = "gem man --system"
rmde = "find . -type d -empty -not -path '*.git*' -delete"
bashe = '$EDITOR $HOME/.config/bash/env.sh'
bashs = 'exec $SHELL'

Network

sshe = '$EDITOR $HOME/.ssh/config'
key = "open /Applications/Utilities/Keychain\ Access.app"
ipa = 'curl --silent checkip.dyndns.org | ag --only-matching "[0-9\.]+" | _copy_and_print'
sniff = "sudo ngrep -W byline -d 'en0' -t '^(GET|POST) ' 'tcp and port 80'"
dnsi = "scutil --dns"
dnss = "sudo dscacheutil -statistics"
dnsf = "sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder && printf 'DNS cache cleared.\n'"
tsl = "tmux list-sessions"
tsa = "tmux attach-session -t"
tsk = "tmux kill-session -t"
tsr = "tmux rename-session -t"
hb = "brew"
hbi = "brew install"
hbin = "brew info"
hbu = "brew uninstall"
hbl = "brew list"
hbs = "brew search"
hbsw = "brew switch"
hbup = "brew update"
hbug = "brew upgrade"
hbp = "brew pin"
hbpu = "brew unpin"
hbd = "brew doctor"
hbc = "brew cleanup"
hbsu = "hbup && hbug && hbc"
gi = "git init"
gcle = "git config --local --edit"
gcge = "git config --global --edit"
gcd = "git config --show-origin"
gget = "git config --get"
gset = "git config --add"
gst = "git status --short --branch"
gl = 'git log --graph --pretty=format:"$(_git_log_line_format)"'
gld = 'git log --stat --pretty=format:"$(_git_log_details_format)"'
glh = 'git log --pretty=format:%h -1 | _copy_and_print'
glf = 'git fetch && git log --reverse --no-merges --pretty=format:"$(_git_log_line_format)" ..@{upstream}'
glg = 'git log --pretty=format:"$(_git_log_line_format)" --grep'
gls = 'git log --pretty=format:"$(_git_log_line_format)" -S'
glt = 'git for-each-ref --sort=taggerdate --format = "%(color:yellow)%(refname:short)%(color:reset)|%(taggerdate:short)|%(color:blue)%(color:bold)%(*authorname)%(color:reset)|%(subject)" refs/tags | column -s"|" -t'
grl = "git reflog"
gg = "git grep"
guthors = "git log --format = '%an' | sort | uniq -c | sort --reverse"
gd = "git diff"
gdc = "git diff --cached"
gdm = "git diff origin/master"
gdw = "git diff --color-words"
gdo = 'git diff --name-only | uniq | xargs $EDITOR'
gdt = "git difftool"
gdtc = "git difftool --cached"
gdtm = "git difftool origin/master"
glame = "git blame -M -C -C -C"
gbi = "git bisect"
gbis = "git bisect start"
gbib = "git bisect bad"
gbig = "git bisect good"
gbir = "git bisect reset"
gbisk = "git bisect skip"
gbil = "git bisect log"
gbire = "git bisect replay"
gbiv = 'git bisect visualize --reverse --pretty=format:"$(_git_log_line_format)"'
gbih = "git bisect help"
gb = "git branch --verbose"
gbt = "git show-branch --topics"
gba = "git branch --all"
gbn = "_git_branch_name | _copy_and_print"
gbr = "git branch --move"
gm = "git merge"
gcl = "git clone"
gch = "git checkout"
gchm = "git checkout master"
ga = "git add"
gau = "git add --update"
gap = "git add --patch"
gall = "git add --all ."
gco = "git commit"
gatch = "git commit --patch"
gca = "git commit --all"
gcm = "git commit --message"
gcam = "git commit --all --message"
gcf = "git commit --fixup"
gcs = "git commit --squash"
gamend = "git commit --amend"
gamendh = "git commit --amend --no-edit"
gamenda = "git commit --amend --all --no-edit"
gcp = "git cherry-pick"
gcpa = "git cherry-pick --abort"
gashc = "git stash clear"
gnl = "git notes list"
gns = "git notes show"
gna = "git notes add"
gne = "git notes edit"
gnd = "git notes remove"
gnp = "git notes prune"
gf = "git fetch"
gfp = "git fetch --prune"
gpu = "git pull"
gpuo = "git pull origin"
gpuom = "git pull origin master"
grbc = "git rebase --continue"
grbs = "git rebase --skip"
grba = "git rebase --abort"
ger = "git rerere"
gp = "git push"
gpf = "git push --force-with-lease"
gpn = "git push --no-verify"
gpo = "git push --set-upstream origin"
gpr = "git push review master"
gps = "git push stage stage:master"
gpp = "git push production production:master"
gtag = "git tag"
gtagv = "git tag --verify"
gtags = "git push --tags"
gwl = "git worktree list"
gwp = "git worktree prune"
gr = "git reset" # Unstage staged files for commit.
grm = "git reset --merge ORIG_HEAD" # Reset to original HEAD prior to merge.
grom = "git fetch --all && git reset --hard origin/master" # Reset local branch to origin/master branch. UNRECOVERABLE!
gel = "git rm"
gelc = "git rm --cached" # Removes previously tracked file from index after being added to gitignore.
grev = "git revert" # Revert a commit.
grp = "git remote prune origin"
glean = "git clean -d --force"
bzc = "tar --use-compress-program=pigz --create --preserve-permissions --bzip2 --verbose --file"
bzx = "tar --extract --bzip2 --verbose --file"
pgi = "initdb /usr/local/var/postgres"
pgst = "pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start &"
pgsp = "pg_ctl -D /usr/local/var/postgres stop -s -m fast"
reds = "redis-server /usr/local/etc/redis.conf &"
redc = "redis-cli"
esst = "elasticsearch --daemonize"
essp = "kilp elasticsearch"
crb = "chruby"
rbi = "ruby-install"
gemcr = '$EDITOR ~/.gem/credentials'
geml = "gem list"
gemi = "gem install"
gemup = "gem update"
gemu = "gem uninstall"
gemc = "gem cleanup"
gems = "gem server"
gemp = "gem pristine"
geme = "gem environment"
gemuc = "gem update --system && gem update && gem cleanup"
gemcli = "ag --depth=1 --files-with-matches --file-search-regex gemspec executables | xargs basename | cut -d. -f1 | _copy_and_print '\n'"
gemw = "gem whois"
bert = "ber -T"
b = "bundle"
bs = "bundle show"
bl = "bundle lock"
bi = "bundle install"
bu = "bundle update"
bo = "bundle outdated"
bce = '$EDITOR $HOME/.bundle/config'
bcon = "bundle console"
be = "bundle exec"
bch = "rm -f Gemfile.lock; bundle check"
ms = "milestoner"
msc = 'milestoner --commits | _copy_and_print "\n"'
msp = "milestoner --publish"
mse = "milestoner --config --edit"
gs = "gemsmith"
gsg = "gemsmith --generate"
gse = "gemsmith --config --edit"
gsr = "gemsmith --read"
gso = "gemsmith --open"
gsi = "bundle exec rake install"
gsp = "bundle exec rake publish"
gsq = "bundle exec rake code_quality"
pas = "pragmater --add . --comments '# frozen_string_literal: true' --whitelist 'Gemfile' 'Guardfile' 'Rakefile' 'config.ru' 'bin/**/*' '.gemspec' '.rake' '.rb'"
bess = "bes spec"
best = "bess --tag"
besn = "bess --next-failure"
besf = "bess --only-failures"
scs = "sc --sandbox"
sgc = "sg controller"
sgm = "sg model"
dbd = "ber db:drop"
dbc = "ber db:create"
dbm = "ber db:migrate"
dbmt = "ber db:migrate && ber db:rollback && ber db:migrate"
taild = "tail -f log/development.log"
tailt = "tail -f log/test.log"
res = "touch tmp/restart.txt"
elmc = "elm repl"
elms = "elm reactor"
elmp = "elm package"
elmi = "elm package install"
elmt = "elm test"
cop = "rubocop --parallel --display-cop-names"
copc = "rubocop --auto-gen-config"
copo = "rubocop --display-cop-names --only"
copf = "rubocop --auto-correct"
cops = "rubocop --show-cops"
copd = 'find . -name ".rubocop-http*" -type f -delete'
rbp = "rails_best_practices"
cov = "open coverage/index.html"
fms = "foreman start --env /dev/null"
agf = "ag --hidden --files-with-matches --file-search-regex"
denva = "direnv allow"
denvr = "direnv reload"
denvs = "direnv status"
ze = '$EDITOR $HOME/.z'
itl = 'printf "\033]0;${PWD##*/}\007"'
pfo = 'open -a "Path Finder.app" "$PWD"'
v = "vim"
e = "sublime"
mo = "open -a Marked\ 2"
cin = "asciinema"
cinp = "asciinema play"
cinu = "asciinema upload"

Functions

General

t2s = Tab to Space - Convert file from tab to space indendation.
cype = Colorized Type - Identical to "type" command functionality but with syntax highlighting.
pss = Process Status (specialized) - Display process status, excluding the search of it, and ignoring case.
kilp = Kill Process - Kill errant processes.
lessi = Less Interactive - Inspect file, interactively.
sslc = SSL Certificate Creation - Create SSL certificate.
curli = Curl Inspect - Inspect remote file with default editor.
port = Port - List file activity on given port.
gia = Git Init (all) - Initialize/re-initialize repositories in current directory.
groot = Git Root - Change to repository root directory regardless of current depth.
ginfo = Git Info - Print repository overview information.
gstats = Git Statistics - Answer statistics for current project.
gstatsa = Git Statistics (all) - Answer statistics for all projects in current directory.
ghurn = Git Churn - Answer commit churn for project files (sorted highest to lowest).
gount = Git Commit Count - Answer total number of commits for current project.
gli = Git Log (interactive) - List commits with support to show/diff individual commits.
ghow = Git Show - Show commit details with optional diff support.
gile = Git File - Show file details for a specific commit (with optional diff support).
gistory = Git File History - View file commit history (with optional diff support).
glameh = Git Blame History - View file commit history for a specific file and/or lines (with optional diff support).
guthorsa = Git Authors (all) - Answer author commit activity per project (ranked highest to lowest).
gsta = Git Status (all) - Answer status of projects with uncommited/unpushed changes.
gup = Git Update - Fetch commits, prune untracked references, review each commit (optional, with diff), and pull (optional).
gync = Git Sync - Syncs up remote changes and deletes pruned/merged branches.
gseta = Git Set Config Value (all) - Set key value for projects in current directory.
ggeta = Git Get Config Value (all) - Answer key value for projects in current directory.
gunseta = Git Unset (all) - Unset key value for projects in current directory.
gailsa = Git Email Set (all) - Sets user email for projects in current directory.
gail = Git Email Get - Answer user email for current project.
gaila = Git Email Get (all) - Answer user email for projects in current directory.
gince = Git Since - Answer summarized list of activity since date/time for projects in current directory.
gday = Git Day - Answer summarized list of current day activity for projects in current directory.
gweek = Git Week - Answer summarized list of current week activity for projects in current directory.
gmonth = Git Month - Answer summarized list of current month activity for projects in current directory.
gsup = Git Standup - Answer summarized list of activity since yesterday for projects in current directory.
gtail = Git Tail - Answer commit history since last tag for current project (copies results to clipboard).
gtaila = Git Tail (all) - Answer commit history count since last tag for projects in current directory.
gash = Git Stash - Creates stash.
gashl = Git Stash List - List stashes.
gashs = Git Stash Show - Show stash or prompt for stash to show.
gashp = Git Stash Pop - Pop stash or prompt for stash to pop.
gashd = Git Stash Drop - Drop stash or prompt for stash to drop.
gasha = Git Stash (all) - Answer stash count for projects in current directory.
gucca = Git Upstream Commit Count (all) - Answer upstream commit count since last pull for projects in current directory.
gpua = Git Pull (all) - Pull new changes from remote branch for projects in current directory.
galla = Git Add (all) - Apply file changes (including new files) for projects in current directory.
gcfp = Git Commit Fix and Push - Create fixup commit, push, and copy URL to clipboard.
gcaa = Git Commit (all) - Commit changes (unstaged and staged) for projects in current directory.
gcap = Git Commit and Push (all) - Commit and push changes for projects in current directory.
gpob = Git Push Origin Branch - Pushes current branch to origin and sets upstream tracking.
gpa = Git Push (all) - Push changes for projects in current directory.
gri = Git Rebase (interactive) - Rebase commits, interactively.
gra = Git Rebase (automatic) - Rebase commits, automatically. Identical to `gri` function but skips editor.
gbl = Git Branch List - List local and remote branch details.
gbla = Git Branch List (all) - List current branch for projects in current directory.
gbc = Git Branch Create - Create and switch to branch.
gbs = Git Branch Switch - Switch between branches.
gbsa = Git Branch Switch (all) - Switch to given branch for projects in current directory.
gbna = Git Branch Number (all) - Answer number of branches for projects in current directory.
gbd = Git Branch Delete - Select local and/or remote branches to delete.
gbdm = Git Branch Delete Merged - Delete remote and local merged branches.
gtagd = Git Tag Delete - Delete local and remote tag (if found).
gwa = Git Worktree Add - Add and switch to new worktree.
gwd = Git Worktree Delete - Deletes current Git worktree.
grs = Git Reset Soft - Resets previous commit (default), resets back to number of commits, or resets to specific commit.
grh = Git Reset Hard - Reset to HEAD, destroying all untracked, staged, and unstaged changes. UNRECOVERABLE!
grha = Git Reset Hard (all) - Destroy all untracked, staged, and unstaged changes for all projects in current directory. UNRECOVERABLE!
guke = Git Nuke - Permanently destroy and erase a file from history. UNRECOVERABLE!
gleana = Git Clean (all) - Clean uncommitted files from all projects in current directory.
gvac = Git Verify and Clean - Verify and clean objects for current project.
gvaca = Git Verify and Clean (all) - Verify and clean objects for projects in current directory.
gh = GitHub - View GitHub details for current project.
ghpra = GitHub Pull Request (all) - Open pull request for all projects in current directory (non-master branches only).
pguc = PostgreSQL User Create - Create PostgreSQL user.
pgud = PostgreSQL User Drop - Drop PostgreSQL user.
pgt = PostgreSQL Template - Edit PostgreSQL template.
rbva = Ruby Version (all) - Show current Ruby version for all projects in current directory.
rbua = Ruby Upgrade (all) - Upgrade Ruby projects in current directory with new Ruby version.
rbs = Ruby Server - Serve web content from current directory via WEBrick.
gemdep = Gem Dependency Search - Finds a gem defined within a Gemfile or a gemspec.
bj = Bundler Jobs - Answer maximum Bundler job limit for current machine or automatically set it.
bcg = Bundler Config Gem - Configure Bundler gem path for development.
bcim = Bundler Config Ignore Post-Install Message - Configure Bundler to ignore install messages for specified gem.
boa = Bundle Outdated (all) - Answer outdated gems for projects in current directory.
bua = Bundle Update (all) - Update gems for projects in current directory.
bca = Bundle Clean (all) - Clean projects of gem artifacts (i.e. pkg folder).
ber = Bundle Execute Rake - Run Rake via binstub or Bundler.
bera = Bundle Execute Rake (all) - Run default Rake tasks via binstub or Bundler for projects in current directory.
cqa = Code Quality (all) - Run code quality tasks via binstub or Bundler for projects in current directory.
bes = Bundle Execute RSpec - Run RSpec via binstub or Bundler.
besb = Bundle Exec RSpec Bisect - Debug RSpec failure using bisect to automatically determine where failure is occuring.
besd = Bundle Exec RSpec Debug - Debug intermittent RSpec failure(s) by running spec(s) until failure is detected.
besp = Bundle Exec RSpec Profile - Runs RSpec specs with profiling enabled.
bessa = Bundle Execute RSpec (all) - Run RSpec via binstub or Bundler for projects in current directory.
beg = Bundle Execute Guard - Run Guard via binstub or Bundler.
rew = Rails New - Create new Rails application from selected template.
sc = Rails Script Console - Run Rails console.
ss = Rails Script Server - Run Rails server.
sg = Rails Script Generator - Run Rails generator.
sdb = Rails Script Database Console - Run Rails database console.
erd = Rails ERD - Generate Rails Entity Relationship Diagram (ERD).
rr = RailRoady Models - Generate diagrams for Rails models, controllers, or states.
elmm = Elm Make - Compile Elm source.
elml = Elm Live Reload - Watch for source code changes and recompile immediately.
gifize = Gifize - Convert video to animated GIF.
cinr = asciinema Record - Create new asciinema recording.

Dotfiles

dots = Dotfiles - Learn about dotfile aliases, functions, etc.

Git Hooks

bundler_gemfile_path = Bundler Gemfile Path - Detect gem path statements.
capybara_save_and_open_page = Capybara Save And Open Page - Detect save_and_open_page statements.
comments_total = Print Comment Totals - Print project comment totals.
ctags_rebuild = CTags Rebuild - Rebuild project .tags file.
elm_debug = Elm Debug - Detect debug statements.
git_cop = Git Cop - Enforces consistent Git commits.
jasmine_focus = Jasmine Focus - Detect Jasmine focus statements.
java_script_debugger = JavaScript Debugger - Detect JavaScript debug statements.
java_script_console = JavaScript Console - Detect JavaScript console statements.
java_script_alert = JavaScript Alert - Detect JavaScript alert statements.
pry_binding = Pry Binding - Detect Pry debug statements.
reek_check = Reek - Scans Ruby code for poor style choices.
rspec_focus = RSpec Focus - Detect RSpec focus.
rubocop_check = Rubocop - Scans Ruby code for poor style choices.
irb_binding = IRB Binding - Detect IRB debug statements.
scss_lint_check = SCSS Lint - Scans SCSS code for poor style choices.

IRB, Pry, and Rails consoles

ConsoleKit.locate - Locates source code for given object and method.
ConsoleKit.search - Searches for object method for given pattern.
ConsoleKit.copy - Copies data to OS X clipboard.
ConsoleKit.paste - Pastes data from OS X clipboard.

Pry Aliases

'w' = "whereami"
'c' = "continue"
's' = "step"
'n' = "next"
'f' = "finish"
"bp" = "break"
"bpe" = "break --enable"
"bpd" = "break --disable"
"bpD" = "break --delete"
"bpc" = "break --disable-all"
"bpC" = "break --delete-all"
"bph" = "break --help"

Versioning

Read Semantic Versioning for details. Briefly, it means:

  • Major (X.y.z) - Incremented for any backwards incompatible public API changes.
  • Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
  • Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.

Code of Conduct

Please note that this project is released with a CODE OF CONDUCT. By participating in this project you agree to abide by its terms.

Contributions

Read CONTRIBUTING for details.

License

Copyright (c) 2010 Alchemists. Read LICENSE for details.

History

Read CHANGES for details. Built with Bashsmith.

Credits

Developed by Brooke Kuhlmann at Alchemists.

dotfiles's People

Contributors

bkuhlmann avatar mtfranchetto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.