refactor: sheldon is dead long live chezmoi

This commit is contained in:
Daylin Morgan 2023-01-24 10:06:40 -06:00
parent b449a96b8e
commit d343002dde
7 changed files with 78 additions and 8 deletions

1
.gitignore vendored
View file

@ -159,3 +159,4 @@ cython_debug/
# End of https://www.toptal.com/developers/gitignore/api/python
.task.mk
lib/plugins/

View file

@ -0,0 +1,52 @@
.dotfiles/lib/plugins/base16:
rereshPeriod: 168h
type: git-repo
url: https://github.com/chriskempson/base16-shell.git
.dotfiles/lib/plugins/zsh-defer:
rereshPeriod: 168h
type: git-repo
url: https://github.com/romkatv/zsh-defer.git
.dotfiles/lib/plugins/zsh-syntax-highlighting:
rereshPeriod: 168h
type: git-repo
url: https://github.com/zsh-users/zsh-syntax-highlighting.git
.dotfiles/lib/plugins/fzf-tab:
rereshPeriod: 168h
type: git-repo
url: https://github.com/Aloxaf/fzf-tab.git
.dotfiles/lib/plugins/oh-my-zsh:
type: "archive"
url: https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz
# exact: true
# chezmoi refuses to mkdir with nested directories
stripComponents: 2
refreshPeriod: "168h"
include:
- "*/lib/{clipboard,completion}.zsh"
- "*/plugins/{dotenv,extract}/**"
#
# include:
#
# - "*/plugins/{dotenv,extract}/**/*"
# include: ["plugins/dotenv/**", "plugins/extract/**"]
# .oh-my-zsh:
# exact: true
# refreshPeriod: 168h
# stripComponents: 1
# type: archive
# url: https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz
# .oh-my-zsh/custom/plugins/zsh-syntax-highlighting:
# exact: true
# refreshPeriod: 168h
# stripComponents: 1
# type: archive
# url: https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz
# .oh-my-zsh/custom/themes/powerlevel10k:
# exact: true
# stripComponents: 1
# type: archive
# url: https://github.com/romkatv/powerlevel10k/archive/v1.15.0.tar.gz

View file

@ -12,7 +12,7 @@ fi
PATH="$DOTFILES_DIR/bin:$PATH"
. $DOTFILES_DIR/lib/function.zsh
for DOTFILE in "$DOTFILES_DIR"/lib/{path,env,prompt,alias,conda,custom}.zsh; do
for DOTFILE in "$DOTFILES_DIR"/lib/{path,env,prompt,alias,conda,plugins,custom}.zsh; do
[ -f "$DOTFILE" ] && . "$DOTFILE"
done

View file

@ -5,7 +5,7 @@ CURDIR=${0:a:h}
gen() {
if is-executable $1; then
echo "$1 updated"
"$@" | sed "s#$HOME#\$HOME#g" > $CURDIR/"_$argv[1]"
"$@" | sed "s#$HOME#\$HOME#g" >$CURDIR/"_$argv[1]"
else
echo "skipping $1"
fi

View file

@ -34,6 +34,7 @@ export FZF_DEFAULT_OPTS=${FZF_COLORS}${FZF_LAYOUT}
export FZF_CTRL_GENERAL="--height=100% --margin=0,0,0"
#adapted from https://github.com/zimfw/fzf/blob/master/init.zsh
# TODO: fix this so it works with $ **<tab>
if [ -x "$(command -v fd)" ]; then
export FZF_DEFAULT_COMMAND="command fd --type file --exclude ".git/" --hidden --no-ignore"
_fzf_compgen_path() {

22
lib/plugins.zsh Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env zsh
PLUGINS_DIR=$DOTFILES_DIR/lib/plugins
source $PLUGINS_DIR/zsh-defer/zsh-defer.plugin.zsh
# TODO: automate collection of plugin files
plugins=(
base16/base16-shell.plugin.zsh
fzf-tab/fzf-tab.plugin.zsh
zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
oh-my-zsh/clipboard.zsh
oh-my-zsh/completion.zsh
oh-my-zsh/dotenv/dotenv.plugin.zsh
oh-my-zsh/extract/extract.plugin.zsh
)
for plugin in $plugins; do
zsh-defer source $PLUGINS_DIR/$plugin
done
unset PLUGINS_DIR plugins

View file

@ -3,12 +3,6 @@
autoload -Uz compinit
compinit
if is-executable sheldon; then
eval "$(sheldon -q --config-file ~/.config/sheldon/plugins.toml source)"
else
echo "no sheldon = no shell extensions loaded"
fi
is-executable zoxide && eval eval "$(zoxide init zsh --cmd cd)"
if is-executable starship; then