diff --git a/config/rtx/config.toml b/config/rtx/config.toml new file mode 100644 index 0000000..0736ab5 --- /dev/null +++ b/config/rtx/config.toml @@ -0,0 +1,3 @@ +[settings] +experimental = true +shims_dir = "~/.rtx/shims" diff --git a/install.sh b/install.sh index 95379a0..4101ae8 100755 --- a/install.sh +++ b/install.sh @@ -15,6 +15,7 @@ SYMLINKS=( bitbar coffeelint.json config/kitty/kitty.conf + config/rtx/config.toml config/solargraph/config.yml config/starship.toml erlang @@ -28,7 +29,6 @@ SYMLINKS=( irbrc peco powconfig - prettierrc.js pryrc reek.yml rspec @@ -36,6 +36,7 @@ SYMLINKS=( rustfmt.toml tmux tmux.conf + tool-versions zshenv zshrc ) diff --git a/prettierrc.js b/prettierrc.js deleted file mode 100644 index b6d00e3..0000000 --- a/prettierrc.js +++ /dev/null @@ -1,50 +0,0 @@ -const homedir = require('os').homedir(); -const fs = require("fs"); - -function voltaPrettierSearchDirs(voltaDir) { - const packagesDir = `${voltaDir}/tools/image/packages`; - - let paths = [] - let parents = []; - - fs.readdirSync(packagesDir).forEach((item) => { - if (/^prettier-plugin-[^/]+$/.test(item)) { - paths.push(`${packagesDir}/${item}/lib`); - } - - if (item == '@prettier') { - paths = paths.concat( - findDirs(`${packagesDir}/@prettier`, /^plugin-[^/]+$/, "lib") - ); - } else if (/^@[^/]+$/.test(item)) { - parents.push(`${packagesDir}/${item}`); - } - - return []; - }) - - parents.forEach((parent) => { - paths = paths.concat(findDirs(parent, /^prettier-plugin-[^/]+$/, "lib")); - }) - - return paths; -} - -function findDirs(parent, pattern, suffix) { - return fs.readdirSync(parent).flatMap((item) => { - const fp = `${parent}/${item}`; - if (pattern.test(item) && fs.statSync(fp).isDirectory()) { - if (suffix) { - return `${fp}/${suffix}`; - } - return fp; - } - - return []; - }); - -} - -module.exports = { - pluginSearchDirs: voltaPrettierSearchDirs(`${homedir}/.volta`), -}; diff --git a/tool-versions b/tool-versions new file mode 100644 index 0000000..3c1308d --- /dev/null +++ b/tool-versions @@ -0,0 +1,11 @@ +bat latest +direnv latest +dust latest +exa latest +golang latest +jq latest +nodejs lts +python latest +shellcheck latest +shfmt latest +starship latest diff --git a/zsh/direnv.zsh b/zsh/direnv.zsh deleted file mode 100644 index d02ffa8..0000000 --- a/zsh/direnv.zsh +++ /dev/null @@ -1,9 +0,0 @@ -# -# direnv setup -# - -zinit light-mode wait lucid from'gh-r' as'program' pick'direnv' \ - mv'direnv* -> direnv' \ - atclone'./direnv hook zsh > .zinitrc.zsh' atpull'%atclone' \ - src='.zinitrc.zsh' \ - for @direnv/direnv diff --git a/zsh/fzf.zsh b/zsh/fzf.zsh index b06b069..b51ac49 100644 --- a/zsh/fzf.zsh +++ b/zsh/fzf.zsh @@ -2,10 +2,10 @@ # fzf # -export FZF_DEFAULT_OPTS="--bind=ctrl-k:kill-line --border=none --tabstop=4" -export FZF_TMUX_HEIGHT=100% -export FZF_TMUX=0 export FZF_CTRL_T_OPTS="--preview='less {}'" +export FZF_DEFAULT_OPTS="--bind=ctrl-k:kill-line --border=none --tabstop=4" +export FZF_TMUX=0 +export FZF_TMUX_HEIGHT=100% # Install fzf binary from latest GitHub Release. zinit light-mode wait lucid from'gh-r' as'program' pick'fzf' \ diff --git a/zsh/golang.zsh b/zsh/golang.zsh index 682a124..7c5a4c0 100755 --- a/zsh/golang.zsh +++ b/zsh/golang.zsh @@ -2,24 +2,9 @@ # Go (golang) environment setup. # -# -# g - Simple go version manager, gluten-free -# - -# Create symlink for "g" called "gv", as I have "g" aliased to "git". -zinit light-mode wait lucid as'program' pick'bin/g' from'gh' \ - atclone'cd bin && ln -s g gv' atpull'%atclone' \ - for @stefanmaric/g - -# -# gup - Update binaries installed with "go install" -# -zinit light-mode wait lucid as'program' from'gh-r' pick'gup' \ - for @nao1215/gup - -# +# ============================================================================== # global golang packages -# +# ============================================================================== list_go_global_packages() { for bin in $(ls -1 ~/.go/bin); do diff --git a/zsh/jq.zsh b/zsh/jq.zsh deleted file mode 100644 index 6d17e8d..0000000 --- a/zsh/jq.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# -# jq -# - -if ! command-exists jq; then - zinit light-mode wait lucid from'gh-r' as'program' mv'jq* -> jq' \ - for @stedolan/jq -fi diff --git a/zsh/nodejs.zsh b/zsh/nodejs.zsh index b0aead8..a5768d7 100755 --- a/zsh/nodejs.zsh +++ b/zsh/nodejs.zsh @@ -2,31 +2,11 @@ # Node.js environment setup. # -# ============================================================================== -# Volta -# ============================================================================== - -zinit light-mode wait lucid as'program' from'gh-r' \ - atclone'./volta completions zsh > _volta' atpull'%atclone' \ - for @volta-cli/volta - -# ============================================================================== -# aliases -# ============================================================================== - -alias no="node" -alias np="npm" - # ============================================================================== # global node packages # ============================================================================== install_node_global_packages() { - local volta_packages=( - npm - npx - yarn - ) local npm_packages=( @commitlint/cli @commitlint/config-conventional @@ -57,7 +37,8 @@ install_node_global_packages() { vscode-css-languageserver-bin vscode-json-languageserver yaml-language-server + yarn ) - volta install "${volta_packages[@]}" "${npm_packages[@]}" + npm install -g "${npm_packages[@]}" } diff --git a/zsh/python.zsh b/zsh/python.zsh index 5a44b86..1b92a34 100644 --- a/zsh/python.zsh +++ b/zsh/python.zsh @@ -2,20 +2,6 @@ # Python environment setup. # -# ============================================================================== -# pyenv -# ============================================================================== - -# install pyenv -zinit light-mode wait lucid as'program' pick'bin/pyenv' from'gh' \ - atclone'src/configure && make -C src; libexec/pyenv init - > .zinitrc.zsh' \ - atpull'%atclone' src'.zinitrc.zsh' nocompile'!' \ - for @pyenv/pyenv - -zinit light-mode wait lucid as'program' pick'plugins/python-build/bin/python-build' \ - from'gh' id-as'pyenv/python-build' \ - for @pyenv/pyenv - # ============================================================================== # aliases # ============================================================================== diff --git a/zsh/rclone.zsh b/zsh/rclone.zsh deleted file mode 100644 index 5496300..0000000 --- a/zsh/rclone.zsh +++ /dev/null @@ -1,7 +0,0 @@ -# -# Rclone -# - -zinit light-mode wait lucid as'program' from'gh-r' mv'**/rclone -> rclone' \ - atclone'./rclone genautocomplete zsh - > _rclone' atpull'%atclone' \ - for @rclone/rclone diff --git a/zsh/ruby.zsh b/zsh/ruby.zsh index 8a21ce9..39ba784 100755 --- a/zsh/ruby.zsh +++ b/zsh/ruby.zsh @@ -8,8 +8,8 @@ # Install rbenv zinit light-mode wait lucid as'program' pick'bin/rbenv' from'gh' \ - atclone'src/configure && make -C src; libexec/rbenv init - > .zinitrc.zsh' \ - atpull'%atclone' src'.zinitrc.zsh' nocompile'!' \ + atclone'src/configure && make -C src; libexec/rbenv init - > .rbenv.zsh' \ + atpull'%atclone' src'.rbenv.zsh' nocompile'!' \ for @rbenv/rbenv # install ruby-build diff --git a/zsh/tmux.zsh b/zsh/tmux.zsh index 8234114..e2b1edf 100644 --- a/zsh/tmux.zsh +++ b/zsh/tmux.zsh @@ -12,8 +12,8 @@ alias tmm="tmn -s main" # Tmuxifier zinit light-mode wait lucid as'program' pick'bin/tmuxifier' from'gh' \ - atclone'./bin/tmuxifier init - > .zinitrc.zsh' atpull'%atclone' \ - src='.zinitrc.zsh' \ + atclone'./bin/tmuxifier init - > .tmuxifier.zsh' atpull'%atclone' \ + src='.tmuxifier.zsh' \ for @jimeh/tmuxifier alias m="tmuxifier" diff --git a/zshenv b/zshenv index d1027e5..cc2d59d 100644 --- a/zshenv +++ b/zshenv @@ -59,6 +59,15 @@ path_prepend () { fi } +# ============================================================================== +# Helpers +# ============================================================================== + +command-exists() { + (( ${+commands[$1]} )) + return $? +} + # ============================================================================== # System Environment Setup # ============================================================================== @@ -171,35 +180,23 @@ fi # Use custom tmux install if available path_prepend "/opt/tmux/bin" -# Go setup (./zsh/golang.zsh) -export GOPATH="$HOME/.go" -export GOROOT="$HOME/.local/go" -path_prepend "$GOPATH/bin" - # Ruby setup for rbenv (./zsh/ruby.zsh) path_prepend "$HOME/.rbenv/shims" -# Python setup for pyenv (./zsh/python.zsh) -path_prepend "$HOME/.pyenv/shims" - -# Node setup for volta (./zsh/nodejs.zsh) -path_prepend "$HOME/.volta/bin" - # Rust setup -path_prepend "$HOME/.cargo/bin" +export CARGO_HOME="$HOME/.cargo" +path_prepend "$CARGO_HOME/bin" + +# RTX shim setup +path_prepend "$HOME/.rtx/shims" # ============================================================================== # Path setup for select binaries installed with zinit # ============================================================================== -path_prepend "$HOME/.local/zsh/zinit/plugins/direnv---direnv" +path_prepend "$HOME/.local/zsh/zinit/plugins/jdxcode---rtx" path_prepend "$HOME/.local/zsh/zinit/plugins/junegunn---fzf" -path_prepend "$HOME/.local/zsh/zinit/plugins/mvdan---sh" -path_prepend "$HOME/.local/zsh/zinit/plugins/pyenv---pyenv/bin" path_prepend "$HOME/.local/zsh/zinit/plugins/rbenv---rbenv/bin" -path_prepend "$HOME/.local/zsh/zinit/plugins/rclone---rclone" -path_prepend "$HOME/.local/zsh/zinit/plugins/stefanmaric---g/bin" -path_prepend "$HOME/.local/zsh/zinit/plugins/volta-cli---volta" # ============================================================================== # Local Overrides diff --git a/zshrc b/zshrc index aa8acc7..06d0292 100644 --- a/zshrc +++ b/zshrc @@ -9,15 +9,6 @@ if [[ "$OSTYPE" == "darwin"* ]] && [ -f "/etc/zshrc" ]; then source "/etc/zshrc" fi -# ============================================================================== -# Helpers -# ============================================================================== - -command-exists() { - (( ${+commands[$1]} )) - return $? -} - # ============================================================================== # Zinit # ============================================================================== @@ -28,7 +19,7 @@ ZINIT[BIN_DIR]="${ZINIT[HOME_DIR]}/bin" # Load zinit module if it exists. For more info, run: zinit module help if [ -d "${ZINIT[HOME_DIR]}/module/Src/zdharma_continuum" ]; then - module_path+=( "${ZINIT[HOME_DIR]}/module/Src" ) + module_path+=("${ZINIT[HOME_DIR]}/module/Src") zmodload zdharma_continuum/zinit fi @@ -50,11 +41,6 @@ zinit for @OMZ::lib/history.zsh # Enable Ruby Bundler plugin from oh-my-zsh. zinit for @OMZ::plugins/bundler -zinit light-mode lucid as'program' from'gh-r' \ - atclone'./starship completions zsh > _starship; ./starship init zsh --print-full-init > .zinitrc.zsh' \ - atpull'%atclone' pick'starship' src'.zinitrc.zsh' \ - for @starship/starship - zinit light-mode wait lucid \ atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \ for @zdharma-continuum/fast-syntax-highlighting @@ -96,6 +82,38 @@ if [ -f "$DOTPFILES/zshrc" ]; then source "$DOTPFILES/zshrc" fi +# ============================================================================== +# Environment and Tool Managers +# ============================================================================== + +if command-exists direnv; then + eval "$(direnv hook zsh)" +fi + +zinit light-mode wait lucid from'gh-r' as'program' pick'rtx' mv'rtx* -> rtx' \ + atclone'./rtx complete --shell zsh > _rtx && chmod +x _rtx && ./rtx activate zsh > .rtx.zsh' \ + atpull'%atclone' \ + src='.rtx.zsh' \ + for @jdxcode/rtx + +# ============================================================================== +# Prompt +# ============================================================================== + +if command-exists starship; then + eval "$(starship init zsh --print-full-init)" + + _starship() { + unset -f _starship + eval "$(starship completions zsh)" + } + compctl -K _starship starship +else + echo "WARN: starship not found, skipping prompt setup" >&2 + echo " install with: rtx install starship" >&2 + +fi + # ============================================================================== # Tool specific setup # ============================================================================== @@ -111,14 +129,11 @@ if [[ "$OSTYPE" == "linux"* ]]; then source "$DOTZSH/linux.zsh"; fi source "$DOTZSH/1password.zsh" source "$DOTZSH/emacs.zsh" source "$DOTZSH/fzf.zsh" -source "$DOTZSH/jq.zsh" source "$DOTZSH/less.zsh" -source "$DOTZSH/rclone.zsh" source "$DOTZSH/tmux.zsh" # Development source "$DOTZSH/containers.zsh" -source "$DOTZSH/direnv.zsh" source "$DOTZSH/golang.zsh" source "$DOTZSH/google-cloud.zsh" source "$DOTZSH/kubernetes.zsh"