Skip to content

happy-dude/dotfiles

Repository files navigation

Happy-Dude's dotfiles

happy-dude's personal dotfiles repo

This repo is managed solely by myself and configured for my personal workflows and use-cases.

Feel free to browse and adopt any settings to help tweak your own setup; I've done my best to attribute resources in the comments for further details.

My entire workflow is currently based within macOS, reflecting in Unix-compatible configurations. I have not used Linux nor Windows as a daily driver in a while and I will make the appropriate changes to make my settings compatible when I do.

Branches

Multiple branches of dotfiles are useful for different platforms or environments that require modified settings.

There are (currently) two branches, master and macos. macOS users should checkout the macos branch by executing:

git checkout -b macos origin/macos

Submodules

This repo contains git submodules for many configs, vim, and emacs plugin packages.

Each of these project repos have their own maintainers, licenses, and issue trackers. Credit goes to each respective project and their communities for providing useful tool for people like me to use. Please check them out and support them where you can!

Tweaking and Tuning

I recommend starting with minimal configs and adopting tweaks over time that:

  1. streamlines a workflow you perform regularly or
  2. helps overcome and solve a problem at hand.

Approaching your own tweaking and tuning with these points in mind help make settings easy to understand and immediately productive while saving on bloat from superfluous settings you may not actually need.

Install

TODO: write a script that "stowifies" the configs automatically. Take a look at prior-art and remix, transform, and adapt accordingly.

Requirements

  1. Clone the repository and submodules

    git clone --recursive https://github.com/Happy-Dude/dotfiles.git $HOME/dotfiles
    cd $HOME/dotfiles
    git submodule update --init --recursive --remote
  2. Use GNU Stow to symlink configs

    NOTE: stow will not symlink over an existing file or symlink. Check out the manual for more details.

    cd $HOME/dotfiles
    stow vim
    stow tmux
    stow zsh
    ... etc ...

Neovim

Unfortunately, stow does not currently handle directories or files that are symlinked. For example, symlinking neovim/init.vim to vim/vimrc and then running stow on the directories do not have the effect of creating a symlink to the absolute path of the original link, neovim/init.vim.

Since I have my neovim and vim configurations backwards-compatible with each other and using the same directories, I use stow for the base vim configs and use the following symlink for neovim:

ln -s $HOME/dotfiles/.vim $HOME/.config/nvim

Enable True-Color support on (Neo)vim and Tmux w/ terminfo on macOS

Refer to prior-art from bbqtd's excellent gist and jdhao's blog. There is also extra context on the following tmux issues here and here.

terminfo

Grab the latest terminfo database from Thomas E. Dickey, who is brilliant and has worked on projects like ncurses. There is some extra reading available about ncurses, the terminfo database and some thoughts on copyright notices. Check out his GitHub and ncurses-snapshots repo!

  1. Download latest terminfo sources

    curl -LO https://raw.githubusercontent.com/ThomasDickey/ncurses-snapshots/master/misc/terminfo.src
  2. Extract terminfo from source to their compiled formats

    The compiled sources will be outputted to your $HOME/.terminfo directory

    tic -xe tmux,tmux-256color terminfo.src
    
    # Feel free to extra other terminfo sources
    tic -xe screen,screen-256color,xterm,xterm-256color,alacritty,alacritty-direct,kitty terminfo.src
  3. Validate the terminfo sources have been "installed"

    infocmp -x tmux-256color

Tmux

With the above terminfo generated and a terminal emulator that supports "true color" (24-bit), enable the following options in your tmux config. See the tmux FAQ for more details.

set-option -sa terminal-overrides ',*256col*:RGB,'
set-option -ga terminal-overrides ',*256col*:Tc,'

(Neo)vim

Enable the following setting in your vimrc:

if (&t_Co == 256 || &t_Co == 88) && has("termguicolors")
    set termguicolors
endif

'Other' Configs

There are a handful of configs and settings in the 'other' directory which is primarily a collection of useful scripts, configs, and preferences I am currently using or have used in the past.

These are generally not stow-able files since they may not belong in the user's $HOME directory; review them on a case-by-case basis.

Updating

To update the repo, make sure to pull in the latest changes and update submodules:

NOTE: There may be breaking changes within the repo and submodules. Please use due diligence and review each project's commit history and changelog before incorporating updates into your configs.

Fetching Latest Changes

cd $HOME/dotfiles
git fetch --all

Applying Latest Changes

cd $HOME/dotfiles
git pull
git submodule --init --recursive --remote

Misc

tmux, macOS, and copy-paste

Installing tmux on OS X on using Homebrew (and likely Macports also) would cause a message saying launch_msg("SetUserEnvironment"): Socket is not connected error. According to a StackOverflow answer, and ChrisJohnsen's tmux-MacOSX-pasteboard, it seems that OS X's pbcopy and pbpaste "fail to function properly" for applicationsthat run on Terminal emulators and have clipboard access (like vim, tmux, and screen). See thoughtbot's How to Copy and Paste with tmux on Mac OS X and tmux Copy & Paste on OS X: A Better Future for context.

Chris Johnsen's patch should fix this problem. Install his reattach-to-user-namespace wrapper/patch using the following command (if you're using Homebrew):

brew install reattach-to-user-namespace

If you are using Macports, execute

port install tmux-pasteboard

Old iptables Notes (circa 2014)

iptables Rules

NOTE: This has only worked on Ubuntu-based Linux distributions. I need to learn more about the boot process in other distributions to make them work right. I'm looking into seeing how it works for Arch Linux.

ln -s ~/dotfiles/iptables /etc/iptables; \
ln -s ~/dotfiles/iptables/iptables /etc/init.d/iptables; \
chmod +x /etc/init.d/iptables; \
sudo update-rc.d iptables

Execute the script with service iptables start. Again, this so far has only been tested on Ubuntu-based distributions.

To install on Arch Linux (as of April 2013, running systemd), execute the following commands:

ln -s ~/dotfiles/iptables/iptables.rules /etc/iptables/iptables.rules
ln -s ~/dotfiles/iptables/ip6tables.rules /etc/ip6tables/ip6tables.rules
sudo systemctl enable iptables.service

iptables Files

I decided to include my IPTables configuration with this repository, located in the other/iptables directory.

Inside this directory are

  • iptables, the executable script
  • iptables.complete, the full list of iptable rules I have made and exported
  • iptables.current, the list of iptable rules after importing iptables.complete
  • iptables.conf, a configuration file used by the executable script

In Ubuntu, the entire iptables directory should be symlinked into /etc/iptables and the iptables script should be symlinked to /etc/init.d/iptables. Once this is done, you can start and stop your IPTable rules like any other running service by issuing commands such as service iptables start or service iptables stop.

On Arch Linux, this seems to be a little bit different due to how Arch decides to simply some of the configuration and boot process. I have not implemented the scripts on a Arch Linux installtion yet, so I have to do a little bit of reading about the boot process.

Meta

  • Last change: Fri Sep 11 01:22:59 CDT 2020
  • Maintainer: Stanley Chan, a.k.a. Happy-Dude

License

The files and code contributed from myself are in the public domain.

You are free to use, transform, adapt, and/or remix my content however you like.

The submodules included in this project repo have their own maintainers and licenses. Please visit the respective projects' repos to learn more.