My dotfiles. https://github.com/davidosomething/dotfiles
My /uses post may be of interest to you!
Screenshot of my Zsh prompt
Tool | Link |
---|---|
OS support | Arch, macOS, Debian, Ubuntu |
Terminal emulator | WezTerm |
Font | Maple Mono |
Shell | Zsh |
Shell plugins | Zinit |
Editor | Neovim |
Tooling/env | mise |
- XDG compliance wherever possible to keep
$HOME
clean - RC files for Lua, markdownlint, node, PHP, python, R, and others
See macOS specific notes in mac/README.md
Generally:
git clone https://github.com/davidosomething/dotfiles ~/.dotfiles
Then, run the bootstrap/symlink script.
After symlinking, restart the shell. Aliases will be available.
The sshkeygen
alias will help in generating a new SSH key.
Run bootstrap/cleanup to clean up stray dotfiles, moving into their XDG Base Directory supported directories and deleting unnecessary things (with confirmation).
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
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
- The comment character is
nvim/
- See nvim/README.md for more information.
python/
- Never
sudo pip
. Set up a python virtual environment.
- Never
Local dotfiles are read from $LDOTDIR
.
- Put files
zshrc
,bashrc
,npmrc
, andgitconfig
here and they will be automatically sourced, LAST, by the default scripts. No dots on the filenames (i.e. not.zshrc
).
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
- Function bodies
- Never use the
fn() ( subshell body in parentheses )
format, always use curly braces first for consistency:fn() { ( subshell body ); }
.
- Never use the
- 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 (e.g. assume my interactive shells are at least BASH)
- 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