Here is my public configuration for selected command line tools. I checkout this repository to computers I work with.
The dotfiles focus on GNU Bash with the goal of having the shell user-friendly enough to use, but without having extra functionality that would hinder either the shell's start-up or prompt displaying time. I do most of my programming and file editing in Emacs (see my .emacs.d, separate from this repository) or in IntelliJ IDEA; using rich IDEs is another reason for the rather bare-bones shell setup I prefer.
I mainly use macOS, so the tools are optimized for that environment. Rudimentary support for Linux is in place, however, since I occasionally work in a Linux environment for longer periods.
I have copied or adapted some contents from others. For small chunks of code, I have embedded the source URL in a comment inside the file. When copying has been extensive, I have retained the original copyright in the file. Thank you all!
Finally, my motivation for using Bash over more feature-rich shells is that I think tuning .bashrc helps keeping my shell programming skills in shape.
A screenshot from iTerm2, showing the Bash prompt:
The font in use is Input (customization).
I get frustrated if the shell feels sluggish to use. That's why I
optimize the start-up time of my .bashrc
:
time bash --login -i -c true
# => real 0m0.095s
And especially, I want that the shell prompt gets re-displayed quickly:
time eval "$PROMPT_COMMAND"
# => real 0m0.024s
The Bash prompt shows the currently selected versions of
- Node.js, using chnode (
n:$version
at the top of the prompt), - Ruby, using chruby (
r:$version
), and - Java Development Kit, using a tiny shell function called
chjava
defined in .bashrc-common.sh (j:$version
).
For all these programming environments, I want that the environment switching tool (such as chnode) selects the environment version for a shell session. That allows using two different versions of Node.js in separate shells simultaneously.
The .macos.sh script configures macOS quite extensively,
considering what's possible with the defaults
tool and plist files.
The script is originally based on Mathias Bynens' .macos script.
When you configure GNU Global to use Universal Ctags as a symbol parser, it's possible to extend the functionality of Global with the regex based parser definition language of Ctags. For instance, I've added extra support for Yaml, JavaScript, SCSS, and Less files. See .globalrc and custom.ctags.
The downside of regexes is that they're hard to maintain. That's why there's an extensive test suite in gtags-test.sh.
Installing Global with Homebrew:
brew install global
Did you know you can automate testing your shell's init scripts? See bash-test.sh.
Tests are implemented on top of a small custom framework, written in Bash. It was fun to write it. See the sources in the test/support directory.
Run make
at the root of the project in order to learn how to run the
linters and tests.
Install the dotfiles with ./install.sh
, which either symlinks or
copies each file to your home directory. Installation is safe by
default: if the target file exists in your home directory already, the
installer skips symlinking or copying. See ./install -h
for more.
On macOS, install Homebrew to its default prefix directory:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Installing the latest version of Bash, using Homebrew on macOS:
brew install bash
sudo bash -c "echo $(brew --prefix)/bin/bash >> /etc/shells"
chsh -s "$(brew --prefix)/bin/bash"