Migrate from .stow-rename to --dotfiles

This commit is contained in:
Danielle McLean 2023-10-23 15:20:13 +11:00
parent 88a40da33c
commit 57037f5cc4
Signed by: 00dani
GPG key ID: 52C059C3B22A753E
44 changed files with 0 additions and 2 deletions

View file

@ -0,0 +1,2 @@
indicators: true
hyperlink: auto

199
dot-config/starship.toml Normal file
View file

@ -0,0 +1,199 @@
"$schema" = 'https://starship.rs/config-schema.json'
format = '$all$kubernetes$line_break$jobs$battery$time$status$os$container$shell$character'
[character]
success_symbol = "[](bold purple)"
vimcmd_symbol = "[](bold purple)"
[cmd_duration]
format = '[ $duration]($style) '
[git_status]
style = "218"
[custom.task_count_pending]
command = "task count rc.verbose=nothing rc.gc=0 status:pending"
when = "which task"
symbol = " "
description = "Count of pending Taskwarrior tasks"
# https://starship.rs/presets/nerd-font.html
[aws]
disabled = true
symbol = " "
[buf]
symbol = " "
[bun]
format = "[$symbol$version]($style) "
symbol = " "
[c]
symbol = " "
[conda]
symbol = " "
[dart]
symbol = " "
[directory]
truncate_to_repo = false
style = "blue"
read_only = " 󰌾"
[docker_context]
format = "[$symbol$context]($style) "
symbol = " "
[elixir]
symbol = " "
[elm]
symbol = " "
[fossil_branch]
symbol = " "
[git_branch]
format = "[$symbol$branch]($style) "
style = "242"
symbol = " "
[gcloud]
disabled = true
symbol = " "
[golang]
symbol = " "
[guix_shell]
symbol = " "
[haskell]
symbol = " "
[haxe]
symbol = "⌘ "
[hg_branch]
symbol = " "
[hostname]
ssh_symbol = " "
[java]
symbol = " "
[julia]
symbol = " "
[kubernetes]
disabled = false
format = "[$symbol$context]($style) "
symbol = '󰠳 '
style = '33'
[lua]
symbol = " "
[memory_usage]
symbol = "󰍛 "
[meson]
symbol = "󰔷 "
[nim]
symbol = "󰆥 "
[nix_shell]
symbol = " "
[nodejs]
format = "[$symbol($version)]($style) "
symbol = " "
[os.symbols]
Alpaquita = " "
Alpine = " "
Amazon = " "
Android = " "
Arch = " "
Artix = " "
CentOS = " "
Debian = " "
DragonFly = " "
Emscripten = " "
EndeavourOS = " "
Fedora = " "
FreeBSD = " "
Garuda = "󰛓 "
Gentoo = " "
HardenedBSD = "󰞌 "
Illumos = "󰈸 "
Linux = " "
Mabox = " "
Macos = " "
Manjaro = " "
Mariner = " "
MidnightBSD = " "
Mint = " "
NetBSD = " "
NixOS = " "
OpenBSD = "󰈺 "
openSUSE = " "
OracleLinux = "󰌷 "
Pop = " "
Raspbian = " "
Redhat = " "
RedHatEnterprise = " "
Redox = "󰀘 "
Solus = "󰠳 "
SUSE = " "
Ubuntu = " "
Unknown = " "
Windows = "󰍲 "
[package]
format = "[$symbol($version)]($style) "
symbol = "󰏗 "
[perl]
symbol = " "
[php]
format = "[$symbol($version)]($style) "
symbol = " "
[pijul_channel]
symbol = "🪺 "
[python]
format = "[$symbol($version)]($style) "
symbol = " "
[rlang]
symbol = "󰟔 "
[ruby]
symbol = " "
[rust]
symbol = " "
[scala]
symbol = " "
[shlvl]
disabled = false
symbol = " "
[spack]
symbol = "🅢 "
[swift]
symbol = "󰛥 "

1
dot-config/zsh/.zlogout Symbolic link
View file

@ -0,0 +1 @@
zlogout

1
dot-config/zsh/.zprofile Symbolic link
View file

@ -0,0 +1 @@
zprofile

1
dot-config/zsh/.zshrc Symbolic link
View file

@ -0,0 +1 @@
zshrc

View file

@ -0,0 +1,6 @@
#! zsh
ZINIT_HOME=${XDG_CACHE_HOME:-~/.cache}/zsh/zinit
if [[ -e $ZINIT_HOME/bin/zmodules/Src/zdharma/zplugin.so ]]; then
module_path+=( $ZINIT_HOME/bin/zmodules/Src )
zmodload zdharma/zplugin
fi

5
dot-config/zsh/all/env Normal file
View file

@ -0,0 +1,5 @@
#! zsh
# We can't inherit the uniqueness flag -U through the environment, so it must
# be established in every Zsh to guarantee these parameters actually contain
# only unique values.
typeset -U cdpath fpath mailpath manpath path pythonpath

View file

@ -0,0 +1,7 @@
#! zsh
# autoloaded functions must be declared in every kind of zsh: they aren't
# inherited in the environment so non-login shells need them, and you'll want
# to call one in a script so non-interactive shells need them.
autoload count
autoload enphp
autoload -Uz zargs zmv

View file

@ -0,0 +1,2 @@
#! zsh
echo $#

View file

@ -0,0 +1,2 @@
#! zsh
cat $argv | php -r 'echo serialize( json_decode( file_get_contents( "php://stdin" ) ) );'

View file

@ -0,0 +1,7 @@
#! zsh
if [[ -z $BUFFER && -n $jobstates ]]; then
BUFFER=" fg"
zle accept-line
else
zle self-insert '^Z'
fi

View file

@ -0,0 +1,8 @@
#! zsh
local out=("${(@f)$(echo -n 'password: ' && pass show $1)}") field
for field in $out; do
field=(${(s/: /)field})
set -A $2 ${(kv)${(P)2}} $field
# Above is equivalent to $2+=($field) except it's legal syntax ;)
done

View file

@ -0,0 +1,27 @@
#! zsh
# copied from https://github.com/sindresorhus/pure/blob/43aafe0b4dc05174c57ee623c03c64400e832ece/pure.zsh#L56
setopt localoptions noshwordsplit
# Emacs terminal does not support settings the title.
(( ${+EMACS} || ${+INSIDE_EMACS} )) && return
case $TTY in
# Don't set title over serial console.
/dev/ttyS[0-9]*) return;;
esac
# Show hostname if connected via SSH.
local hostname=
if [[ -n $prompt_pure_state[username] ]]; then
# Expand in-place in case ignore-escape is used.
hostname="${(%):-(%m) }"
fi
local -a opts
case $1 in
expand-prompt) opts=(-P);;
ignore-escape) opts=(-r);;
esac
# Set title atomically in one print statement so that it works when XTRACE is enabled.
print -n $opts $'\e]0;'${hostname}${2}$'\a'

View file

@ -0,0 +1,3 @@
#! zsh
autoload prompt_pure_set_title
prompt_pure_set_title 'expand-prompt' '%~'

View file

@ -0,0 +1,3 @@
#! zsh
autoload prompt_pure_set_title
prompt_pure_set_title 'ignore-escape' "$PWD:t: $2"

View file

@ -0,0 +1,6 @@
#! zsh
(( $+commands[fortune] )) || return
for say in ponysay cowsay cat; (( $+commands[$say] )) && break
[[ $say = cowsay ]] && say=(cowsay -n)
[[ $say = ponysay ]] && say=(ponysay -W $(( COLUMNS - 1 )) -b unicode)
fortune $XDG_CACHE_HOME/sav-quotes/quotes | $say

View file

@ -0,0 +1,23 @@
#! zsh
if (( $+commands[bat] )); then
alias cat=bat
fi
if (( $+commands[lsd] )); then
alias ls=lsd
alias tree='lsd --tree'
fi
alias lsl='ls -lh'
alias pseudo=sudo
if (( $+commands[xdg-open] )); then
alias ]=xdg-open
else
alias ]=open
fi
alias cdu=cd-gitroot
# make sure ELinks can detect when it's in tmux
alias elinks="STY= elinks"

View file

@ -0,0 +1,34 @@
#! zsh
_zsh_highlight() {}
zle-line-init() {}
zle -N zle-line-init
autoload -Uz select-word-style
select-word-style shell
# Allow S-Tab to backtrack through the completion menu.
bindkey $terminfo[kcbt] reverse-menu-complete
# Tweaks to vi mode:
bindkey '^?' backward-delete-char # backspace over the start of Insert mode
bindkey 'jj' vi-cmd-mode # inoremap jj <Esc>
# Backward-kill long paths one directory at a time.
bindkey '^W' backward-kill-word
zstyle ':zle:backward-kill-word' word-style unspecified
zstyle ':zle:backward-kill-word' word-chars ' /'
# Make ^Z resume your suspended job if there is one.
autoload fancy-ctrl-z
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
__fzf-z() {
z -l | tac | cut -c 12- | fzf --preview 'tree -FCL 2 {}'
}
fzf-z() {
LBUFFER+="$(__fzf-z)"
zle redisplay
}
zle -N fzf-z
bindkey '^G' fzf-z

View file

@ -0,0 +1,41 @@
#! zsh
# Just show me the completions, *quietly*.
unsetopt list_beep
# If there are no completions, try to correct minor typos in the input.
zstyle :completion:* completer _complete _correct
# Load the nice LS_COLORS into the completion menu too. Pretty!
zstyle :completion:*:default list-colors ${(s.:.)LS_COLORS}
# Kiiiind of make colours work when listing command options. It's weird and
# messy. It works tho'.
zstyle :completion:*:options list-separator \|
zstyle :completion:*:options list-colors \
"=(#b)(-##)([^ ]#) #(\\|)(*)=0=38;5;23=${color[bold]};${color[cyan]}=38;5;237=38;5;242" \
"=(#b)(-##)([^ ]#)(*)=0=38;5;23=${color[bold]};${color[cyan]}" \
"=(#b) #(\\|)(*)=0=38;5;237=38;5;242"
# List the first page, then let me menu through everything.
zmodload zsh/complist # so that listscroll is defined
zstyle :completion:* menu select
zstyle :completion:* list-prompt ' '
zstyle :completion:* select-prompt ' %F{blue}-- %m --%f'
# Permit expensive completions to cache info and therefore be usable.
zstyle :completion::complete:* use-cache on
zstyle :completion::complete:* cache-path $XDG_CACHE_HOME/zsh/compcache
# Group completions under cute headings.
zstyle :completion:* format ' %F{yellow}-- %d --%f'
zstyle :completion:*:corrections format ' %F{green}-- %d (errors: %e) --%f'
zstyle :completion:*:warnings format ' %F{red}-- no matches found --%f'
zstyle :completion:* group-name ''
# When listing directories, treat foo//bar as foo/bar, not foo/*/bar.
zstyle :completion:* squeeze-slashes true
# When completing the names of man pages, group them by section.
zstyle :completion:*:manuals separate-sections true
zstyle :completion:*:manuals.* insert-sections true

View file

@ -0,0 +1,14 @@
#! zsh
alias d=desk
alias d.='desk .'
# Conveniently, the current desk never changes within a single shell session,
# so we can safely just set this once during shell startup.
psvar[1]=$DESK_NAME
# Extend the prompt with desk name display.
PROMPT="%(V.%F{242}%v%f .)$PROMPT"
export DESK_DIR=$XDG_CONFIG_HOME/desk
if [[ -n $DESK_ENV ]]; then
source $DESK_ENV
fi

View file

@ -0,0 +1,8 @@
#! zsh
_direnv_hook() {
eval "$(direnv export zsh)"
}
typeset -ag precmd_functions
if (( $+commands[direnv] )) && [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
precmd_functions+=(_direnv_hook)
fi

View file

@ -0,0 +1,10 @@
#! zsh
HISTFILE=$XDG_DATA_HOME/zsh/history
mkdir -p ${HISTFILE:h}
HISTSIZE=50000
SAVEHIST=$HISTSIZE
setopt extended_history
setopt hist_ignore_all_dups hist_ignore_space
setopt hist_verify
setopt share_history

View file

@ -0,0 +1,6 @@
#! zsh
setopt auto_pushd pushd_ignore_dups
setopt correct
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' menu select=2

View file

@ -0,0 +1,8 @@
#! zsh
if (( $+commands[sk] )); then
# TODO: figure out where lotabout/skim puts these Zsh support files on non-Homebrew installs
[[ $- == *i* ]] && source /usr/local/opt/sk/share/zsh/site-functions/completion.zsh 2>/dev/null
source /usr/local/opt/sk/share/zsh/site-functions/key-bindings.zsh
else
bindkey '^R' history-incremental-search-backward
fi

View file

@ -0,0 +1,3 @@
#! zsh
_Z_DATA=$XDG_DATA_HOME/z/z
mkdir -p ${_Z_DATA:h}

3
dot-config/zsh/login/aws Normal file
View file

@ -0,0 +1,3 @@
#! zsh
: ${AWS_CONFIG_FILE:=$XDG_CONFIG_HOME/aws/config} ${AWS_SHARED_CREDENTIALS_FILE:=$XDG_CONFIG_HOME/aws/credentials}
export AWS_CONFIG_FILE AWS_SHARED_CREDENTIALS_FILE

View file

@ -0,0 +1,2 @@
#! zsh
export EDITOR==vim

View file

@ -0,0 +1,7 @@
#! zsh
fpath=($ZDOTDIR/functions $fpath)
fpath=(${(u)^fpath:#.}(N))
# FPATH isn't exported by default like PATH is - to inherit the setting in
# non-login shells, we need to export it ourselves.
typeset -x FPATH

View file

@ -0,0 +1,4 @@
#! zsh
if [[ -d ~/.gnupg ]]; then
export SSH_AUTH_SOCK=~/.gnupg/S.gpg-agent.ssh
fi

View file

@ -0,0 +1,79 @@
#! zsh
local -a newbins
# docker
export DOCKER_CONFIG=$XDG_CONFIG_HOME/docker
# go
[[ -z $GOPATH ]] && export GOPATH=$XDG_DATA_HOME/go
newbins+=($XDG_DATA_HOME/go/bin)
# haskell
newbins+=(~/.cabal/bin ~/Library/Haskell/bin)
export STACK_ROOT=$XDG_DATA_HOME/stack
# less
# not exactly a 'lang' but still
export LESSHISTFILE=$XDG_DATA_HOME/less/history
# mysql
export MYSQL_HISTFILE=$XDG_DATA_HOME/mysql/history
# o'caml
export OPAMROOT=$XDG_DATA_HOME/opam
[[ -f $OPAMROOT/opam-init/init.zsh ]] && source $OPAMROOT/opam-init/init.zsh
# ooc
if (( $+commands[rock] )); then
export -UT OOC_LIBS ooc_libs
ooc_libs=(/usr/local/Cellar/rock/*(N) $XDG_DATA_HOME/ooc)
newbins+=($XDG_DATA_HOME/ooc/sam/bin)
fi
# ruby
newbins+=(~/.gem/ruby/*/bin(N) /usr/local/opt/ruby/bin /usr/local/lib/ruby/gems/*/bin(N))
export BUNDLE_USER_CONFIG=$XDG_CONFIG_HOME/bundle
export BUNDLE_USER_CACHE=$XDG_CACHE_HOME/bundle
export BUNDLE_USER_PLUGIN=$XDG_DATA_HOME/bundle
# rust
export CARGO_HOME=$XDG_DATA_HOME/cargo
newbins+=($CARGO_HOME/bin)
# perl
export -UT PERL_LOCAL_LIB_ROOT perl_local_lib_root
export -UT PERL5LIB perl5lib
perl_local_lib_root=($XDG_DATA_HOME/perl5 $perl_local_lib_root)
perl5lib=($XDG_DATA_HOME/perl5/lib/perl5 $perl5lib)
newbins+=($XDG_DATA_HOME/perl5/bin)
export PERL_MB_OPT="--install_base '$XDG_DATA_HOME/perl5'";
export PERL_MM_OPT="INSTALL_BASE=$XDG_DATA_HOME/perl5";
# php
export PHIVE_HOME=$XDG_DATA_HOME/phive
# I have no idea why Composer decided that the right place to install global
# packages is $XDG_CONFIG_HOME. It *clearly* should be $XDG_DATA_HOME. But
# there you go, I guess.
newbins+=($XDG_CONFIG_HOME/composer/vendor/bin)
# postgres
export PSQL_HISTORY=$XDG_DATA_HOME/psql/history
# python
export -UT PYTHONPATH pythonpath
newbins+=(~/Library/Python/*/bin(N))
# pipenv already uses $XDG_DATA_HOME, but pyenv doesn't, so we need to
# configure it explicitly.
export PYENV_ROOT=$XDG_DATA_HOME/pyenv
export PYENV_SHELL=zsh
newbins+=($XDG_DATA_HOME/pyenv/shims $HOME/.poetry/bin)
# redis
export REDISCLI_HISTFILE=$XDG_DATA_HOME/redis/rediscli_history
# sqlite
export SQLITE_HISTORY=$XDG_DATA_HOME/sqlite/history
path=($newbins $path)

23
dot-config/zsh/login/npm Normal file
View file

@ -0,0 +1,23 @@
#! zsh
: ${N_PREFIX:=$HOME/.local}
: ${NPM_CONFIG_USERCONFIG:=$XDG_CONFIG_HOME/npm/config}
: ${NODE_REPL_HISTORY:=$XDG_DATA_HOME/node/repl_history}
# The npm configuration file can't be safely committed to version control,
# because things like authorisation tokens for publishing packages to npmjs.org
# live in there. Instead, let's generate a basic npm config here if it doesn't
# already exist.
if [[ ! -a $NPM_CONFIG_USERCONFIG ]]; then
mkdir -p $NPM_CONFIG_USERCONFIG:h
> $NPM_CONFIG_USERCONFIG {
echo cache=$XDG_CACHE_HOME/npm
echo prefix=$HOME/.local
echo store-dir=$XDG_CACHE_HOME/pnpm-store
}
fi
# Node won't create the directory to store its own REPL history if it isn't
# there? It'll just fail to store REPL history. So let's ensure the directory
# exists by ourselves.
mkdir -p $NODE_REPL_HISTORY:h
export N_PREFIX NPM_CONFIG_USERCONFIG NODE_REPL_HISTORY

View file

@ -0,0 +1,4 @@
#! zsh
: ${RANDFILE:=$XDG_CACHE_HOME/openssl/rnd}
mkdir -p $XDG_CACHE_HOME/openssl
export RANDFILE

View file

@ -0,0 +1,4 @@
#! zsh
if [[ -z $PASSWORD_STORE_DIR ]]; then
export PASSWORD_STORE_DIR=$XDG_DATA_HOME/pass
fi

19
dot-config/zsh/login/path Normal file
View file

@ -0,0 +1,19 @@
#! zsh
path=(/usr/local/bin $path)
if (( $+commands[brew] )); then
path=(
/usr/local/opt/coreutils/libexec/gnubin
/usr/local/sbin
~/Library/Python/*/bin(N)
/usr/local/share/google-cloud-sdk/bin
$path
)
fi
path=(/usr/local/texlive/20*/bin/*(N) $path)
path=(~/bin ~/.bin ~/.local/bin $path)
path+=(~/.krew/bin)
# Filter out nonexistent directories, . (the current directory), and duplicate
# paths - there should be no duplicates because of -U but just to be sure. ;)
path=(${(u)^path:#.}(N))

View file

@ -0,0 +1,3 @@
#! zsh
export skip_global_compinit=1
export skip_path_helper=1

View file

@ -0,0 +1,14 @@
#! zsh
export TTC_WEATHER='Sydney, NSW'
export -UT TTC_REPOS ttc_repos ,
ttc_repos=(~/projects)
if [[ -r $XDG_DATA_HOME/twitter/api.zsh ]]; then
source $XDG_DATA_HOME/twitter/api.zsh
export TTC_CONSUMER_KEY=$twitter[consumer_key]
export TTC_CONSUMER_SECRET=$twitter[consumer_secret]
export TTC_ACCESS_TOKEN=$twitter[access_token]
export TTC_ACCESS_TOKEN_SECRET=$twitter[access_secret]
else
export TTC_APIKEYS=false
fi

View file

@ -0,0 +1,14 @@
#! zsh
# umask should *never* be zero. If it is, set it to something safer.
if (( $(umask) == 0 )); then
# Test whether the system uses User Private Groups - if it does, my primary
# group will have the same name as my user. Basic info on UPG can be found
# here: https://security.ias.edu/how-and-why-user-private-groups-unix
if [[ $(id -un) = $(id -gn) ]]; then
# 002 is a safe umask if the system has UPG.
umask 002
else
# 022 is a safe umask if the system does not have UPG.
umask 022
fi
fi

42
dot-config/zsh/zinit Normal file
View file

@ -0,0 +1,42 @@
#! zsh
typeset -A ZINIT
ZINIT[HOME_DIR]=$ZINIT_HOME
ZINIT[ZCOMPDUMP_PATH]=$XDG_CACHE_HOME/zsh/zcompdump
if [[ ! -f $ZINIT_HOME/bin/zinit.zsh ]]; then
git clone https://github.com/zdharma-continuum/zinit $ZINIT_HOME/bin
zcompile $ZINIT_HOME/bin/zinit.zsh
fi
source $ZINIT_HOME/bin/zinit.zsh
load=light
zinit $load willghatch/zsh-saneopt
zinit $load mafredri/zsh-async
zinit $load rupa/z
if (( $+commands[starship] )); then
source <(starship init zsh --print-full-init)
autoload starship_pure_title_precmd starship_pure_title_preexec
precmd_functions+=(starship_pure_title_precmd)
preexec_functions+=(starship_pure_title_preexec)
else
zinit $load sindresorhus/pure
fi
if (( $+commands[vivid] )); then
export LS_COLORS=$(vivid generate molokai)
else
zinit pack:no-dir-color-swap for ls_colors
fi
zinit ice silent wait:1 atload:_zsh_autosuggest_start
zinit $load zsh-users/zsh-autosuggestions
zinit ice blockf; zinit $load zsh-users/zsh-completions
zinit ice silent wait:1; zinit $load mollifier/cd-gitroot
zinit ice silent wait:1; zinit $load micha/resty
zinit ice silent wait:1; zinit $load supercrabtree/k
zinit ice silent wait!1; zinit $load zdharma-continuum/fast-syntax-highlighting

2
dot-config/zsh/zlogout Normal file
View file

@ -0,0 +1,2 @@
#! zsh
for f in $ZDOTDIR/logout/^*.zwc(N); source $f

2
dot-config/zsh/zprofile Normal file
View file

@ -0,0 +1,2 @@
#! zsh
for f in $ZDOTDIR/login/^*.zwc(N); source $f

5
dot-config/zsh/zshenv Normal file
View file

@ -0,0 +1,5 @@
setopt extended_glob
for f in $ZDOTDIR/all/^*.zwc(N); do
[[ ! -f $f.zwc ]] && zcompile $f
source $f
done

12
dot-config/zsh/zshrc Normal file
View file

@ -0,0 +1,12 @@
source $ZDOTDIR/zinit
for f in $ZDOTDIR/interactive/^*.zwc(N); source $f
zpcompinit && zpcdreplay
([[ $ZINIT[ZCOMPDUMP_PATH].zwc -nt $ZINIT[ZCOMPDUMP_PATH] ]] || zcompile $ZINIT[ZCOMPDUMP_PATH]) &!
[[ -o login ]] && for f in $ZDOTDIR/interactive+login/^*.zwc(N); source $f
# If zsh init ends with a failing command (like a conditional) the prompt will
# show the "error" colour on first launch. To avoid this, we simply end with a
# true command:
true