mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
refactor: use rtx to manage Go, Python, NodeJS, and more
This means g, pyenv, and volta are gone. And a lot of other tools previously installed with zinit are also installed with rtx now instead. This includes starship, direnv, shfmt, jq, and more.
This commit is contained in:
3
config/rtx/config.toml
Normal file
3
config/rtx/config.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[settings]
|
||||
experimental = true
|
||||
shims_dir = "~/.rtx/shims"
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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`),
|
||||
};
|
||||
11
tool-versions
Normal file
11
tool-versions
Normal file
@@ -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
|
||||
@@ -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
|
||||
@@ -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' \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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[@]}"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
# ==============================================================================
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
33
zshenv
33
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
|
||||
|
||||
51
zshrc
51
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"
|
||||
|
||||
Reference in New Issue
Block a user