My dotfiles. https://github.com/davidosomething/dotfiles
- macOS/OS X, Arch Linux, and Debian compatible
- XDG compliance wherever possible to keep
$HOME
clean - ZSH and BASH configs
- VIM and Neovim configs
- RC files for Lua, markdown, node, PHP, python, R, ruby, and others
Screenshot of my ZSH prompt
For mac, see full install details in mac/README.md.
Clone and run the symlink script:
git clone --recurse-submodules https://github.com/davidosomething/dotfiles ~/.dotfiles
~/.dotfiles/bootstrap/symlink
After symlinking, bootstrap/cleanup can detect and move pre-existing dotfiles that conflict with these.
Installation assumes the repo is in ~/.dotfiles
but you can set a different
path setting the DOTFILES
environment variable beforehand:
DOTFILES=~/.dot ~/.dot/bootstrap/symlink
- Create XDG child directories (run
bootstrap/xdg
). The X Desktop will export them in/etc/xdg/autostart/user-dirs-update-gtk.desktop
. - Install and use Fira (Fura) Mono for Powerline font (install
to
${XDG_DATA_HOME}/fonts
on *nix) - Install ZSH and set it as the default (ensure its presence in
/etc/shells
); restart the terminal and zplugin will self-install - See OS specific notes in mac/README.md and linux/README.md and linux/arch.md
Install these using the system package manager. For macOS/OS X there are helper scripts.
- chruby,
ruby-install
, then useruby-install
to install a version of ruby (preferably latest, and into~/.config/rubies/ruby-1.2.3
using flags) - Install nvm MANUALLY via git clone into
$XDG_CONFIG_HOME
, then use it to install a version ofnode
(andnpm install --global npm@latest
). Install the default npm packages using scripts in./node
. php
,composer
, use composer to installwp-cli
- Use pyenv-installer for pyenv, pyenv-virtualenv, then create a new env
with a new python/pip.
- Create virtualenvs for Neovim.
These will assist in installing packages and dotfiles. Best to have the environment set up first.
bootstrap/cleanup
moves some dotfiles into their XDG Base Directory supported directories and deletes unnecessary things (with confirmation).bootstrap/symlink
symlinks rc files for bash, ZSH, ack, (Neo)vim, etc.bootstrap/terminfo
will copy/compile terminfo files for user to~/.terminfo/*
bootstrap/x11
symlinks.xbindkeysrc
,.xprofile
npm/install
install default packages, requires you set up nvm and install node firstruby/install-default-gems
requires you set up chruby and install a ruby first.python/install
installs default pip packages. Requires pyenv already set up,
u
is an alias to dot. Use u
without arguments for usage.
bin/
- There's a readme in
bin/
describing each script/binary. This directory is in the$PATH
.
- There's a readme in
local/
- Unversioned folder, put
zshrc
,bashrc
,npmrc
, andgitconfig
here and they will be automatically sourced, LAST, by the default scripts. No dots on the filenames.
- Unversioned folder, put
git/
- The comment character is
#
instead of;
so I can use Markdown in my commit messages without trimming the headers as comments. This is also reflected in a custom Vim highlighting syntax invim/after/syntax/gitcommit.vim
.
- The comment character is
python/
- Never
sudo pip
. Set up a pyenv, and use a pyenv-virtualenv (which will delegate topyvenv
) if doing project specific work, andpip install
into that userspace pyenv or virtualenv.
- Never
ruby/
- Never
sudo gem
. Set up a chruby env first, and then you can install gems into the userspace local to the active ruby env.
- Never
vim/
- If
curl
andgit
are available, vim-plug can automatically download and install itself on first run. See vim/README.md for more information.
- If
If you have node installed, the dkosourced command will show
you (not exhaustively) the order scripts get sourced. Without node echo $DKO_SOURCE
works.
For X apps (no terminal) the value may be:
/etc/profile
.xprofile
shell/vars
shell/xdg
- Script architecture
- Use the
#!/usr/bin/env bash
shebang and write with bash compatibility - Create a private main function with the same name as the shell script.
E.g. for a script called
fun
, there should be a__fun()
that gets called with the original arguments__fun $@
- Two space indents
- Prefer
.
oversource
- Use the
- Function names
- For private functions in a script, use two underscores
__private_func()
These function names are safe to reuse after running the script once. When namespaced, they are in the form of__dko_function_name()
.
- For private functions in a script, use two underscores
- Variable interpolation
- Always use curly braces around the variable name when interpolating in double quotes.
- Variable names
- Stick to nouns, lower camel case
- Variable scope
- Use
local
andreadonly
variables as much as possible over global/shell-scoped variables.
- Use
- Comparison
- Not strict on POSIX, but portability
- Do NOT use BASH arrays, use ZSH or Python if need something complicated
- Use BASH
==
for string comparison - Use BASH
(( A == 2 ))
for integer comparison (note not$A
,$
not needed)
Logo from jglovier/dotfiles-logo