Skip to content

tkareine/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My dotfiles

CI

My public configuration for selected command line tools, in order to synchronize them 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 Mitsuharu Yamamoto's Emacs macOS port (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.

Setup highlights

A screenshot from iTerm2, showing the Bash prompt:

Bash prompt showcase in iTerm2

The font in use is Input (customization).

Fast Bash start-up and prompt display time

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

Show selected versions of programming environments in Bash prompt

The Bash prompt shows the currently selected versions of

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.

macOS configuration

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.

GNU Global configuration

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

Test automation for dotfiles

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.

Installation

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.

Homebrew

On macOS, install Homebrew to its default prefix directory:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Bash

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"