These are the files I use to make the terminal a better place to live and work. :heart:
NOTE: I suggest using iTerm2 instead of the basic Terminal.app that comes with macOS. This will make your life on the command-line much easier. I also recommend supporting the author's work on Patreon.
Follow these directions to set up: https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/
Then run the setup script:
$ setup.shThis is just a simple wrapper to load .bashrc and .bash_aliases.
The guts of my Bash setup. Here's what it does for you:
-
servelets you serve files using a simple web server in the current directory or a directory you specify. Usage:serve [documentroot] [port]. Thedocumentrootdefaults to the current directory and the port defaults to8080. -
ghis a handy way to open the appropriate respository home page for projects on github.com via the command line. It works in three different modes:- Without arguments and in a git repository, it will open the project home page on github.com
- With an argument of a project name, e.g.
vim-vinegar, it will use the github API to find the URL of the repo most likely to be the one you're looking for, then opens that project's home page. Best used when feeling lucky. - With an argument like username/repo, e.g.
tpope/vim-vinegar, it will just open that repo
-
gprwill open a pull request on github.com for the current branch if your current working directory is part of a local git repository.
-
The main thing here is the git-repo-friendly prompt courtesy of bash-git-prompt. You may want to tweak the colors/symbols to your liking.
-
The paths are set up for
npm,node,go, andrbenv -
The
GREP_OPTIONSare given some degree of sanity -
Your shell command history is constrained to 10000 commands
-
Minor typos in
cdcommands will be auto-corrected when possible -
Several other things are initialized, e.g. virtualenv for Python, rbenv for Ruby, shell integration for iTerm2, bash-completion, and z.
-
Make
lsoutput more useful. Show all directories and use some color while doing it. -
Add the
llalias because I fell in love with it while using Linux systems -
"Clear the screen" just by typing
c -
Add a couple of Rails and git aliases. The keystrokes you save may be your own.
- Lets you use Ctrl-R to search backward through your entire command history
-
Ignores case when tab-completing directories and filenames
-
Disables the terminal bell
-
Sets the default command-line editing mode to use vi keybinds instead of emacs, e.g. hit Esc-K to enter edit mode, then K again to move back through your command history or other
vicommand-mode commands to move and edit the current commmand. -
Shows all matches if your tab-completion would be ambiguous
-
.gemrcwill not auto-install rubydocs when you install a gem -
.irbrcenables readline support, with a simple prompt, and enables awesome_print by default -
.pryrcadds some spiffy prompt stuff and a few convenience methods
The .gitignore_global file specifies filename patterns to ignore
globally, and is specified in the .gitconfig file.
The .gitconfig file defines several handy aliases:
-
aliaswill add a new alias, e.g.git alias <alias> <original command> -
aliaseswill list all defined aliases -
bris short forbranch -
changesis a more concise way of showing changed files and their status -
ciis short forcommit -
cois short forcheckout -
dcwill show a diff of staged changes -
dfis short fordiff -
diffstatshows the number of additions/deletions per file -
historyshows a complete diff history for each commit of a given file, e.g.git history package.json -
laststashshows the diff of the most recent stash against the current branch -
lcgives you an annotated log of changes to file(s) or the repo -
lgis a log with "graphing", showing merges and commits with lots of pretty colors 🌈 -
newis a shorter way to create a new branch -
rm-mergedwill locally delete merged branches -
stis short forstatus -
undo-commitwill undo the most recent commit -
whatisshows the commit message and date for a given sha commit hash -
whatsnewdisplays the most recent commit message, author, and date -
whoshows the number of commits per committer. Will make use of a~/.mailmapfile if present to deduplicate and aggregate user names. -
whoisgives you the full name and email address of a user if you provide a username
My Homebrew environment is preserved by way of
Homebrew Bundle which
uses the Brewfile to specify formulae and casks to be installed.
These scripts are all located in the bin directory:
-
download-bing-wallpaper.jswill download the latest Bing Homepage image to your~/Google Drive/Pictures/Bingdirectory and sets your primary desktop background to that image. Add it to a cron job for a fresh picture every day. Only the last 365 days of images are retained. -
colorsshows a color palette so you can tweak your terminal colors -
excusegenerates a programmer's excuse, for example:$ git commit -m "$(excuse)" -
gci,gco,gsq— git commit, checkout, and squash shortcuts -
logicprefsmakes backups of your Logic Pro X preferences, and lets you restore them in case you happen to jack them up. -
mkbrcreates a new git branch -
mkfavicongenerates afavicon.icofile at all the different resolutions you probably will ever need -
mvbrrenames a git branch -
qlis an easy way to use the macOS Quick Look functionality from the command line -
reassociatewill associate source code file extensions with VS Code so you can Command-click a filename in iTerm2 (or double-click the file in Finder) and have it open in VS Code -
rmbrdeletes a git branch, locally and remotely -
sayphrasesays something using the built-in macOS speech synthesis. By default, it says a programming excuse (see above). -
setup.shis the script to install/initialize the rest of my apps -
svg-to-data-uri.shwill take an SVG and URL-encode it for use in a data: URI. Full base64 encoding isn't necessary. -
updallupdates Homebrew formulae/casks and global npm packages
Some settings for use with the pt command, a.k.a. The Platinum
Searcher.
If you see something that is broken, incorrect, or that could be improved, drop me a line or open an issue. Thanks! 😍