use path use str # Convenience function for only setting PATH if the specified directory exists setpath = [path]{ if (path:is-dir $path) { set-env PATH (str:join ':' [$E:PATH $path]) } } # Set paths $setpath /opt/homebrew/bin $setpath ~/.rbenv/shims $setpath ~/.rbenv/bin $setpath ~/.cargo/bin $setpath ~/.local/bin $setpath ~/n/bin $setpath ~/Library/Python/3.7/bin $setpath ~/.asdf/shims # Use private stuff if (path:is-regular ~/.elvish/lib/private.elv) { use private private:init } # Environment variables set-env EDITOR "vim" set-env USER "lu" set-env SHELL (which elvish) set-env TERM xterm-256color set-env N_PREFIX ~/n set-env LANG en_US.UTF-8 set-env LC_ALL en_US.UTF-8 set-env LANGUAGE en_US.UTF-8 set-env RUST_SRC_PATH (and (has-external rustc) (rustc --print sysroot))/lib/rustlib/src/rust/src set-env PYTHONPATH (str:join ':' ["/Users/lu/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/pep582" $E:PYTHONPATH]) set-env TZ_LIST "Europe/Berlin;Berlin,America/New_York;US East,America/Los_Angeles;US West,Europe/London;London" # Aliases fn editconfig []{ exec (chezmoi edit ~/.elvish/rc.elv) eval (cat ~/.elvish/rc.elv | slurp) } fn c [@a]{ cargo $@a } fn cr [@a]{ c run $@a } fn cb [@a]{ c build $@a } fn cwr [@a]{ c watch -x run $@a } fn mkt []{ cd (mktemp -d) } fn czm [@a]{ chezmoi $@a } # Git aliases fn g [@a]{ git $@a } fn gs []{ g status --short } fn gl []{ g log --color --graph --abbrev-commit --online } fn gqp []{ g add --all; g commit; g push} fn gqc []{ g add --all; g commit } fn gpl []{ g pull } fn gps []{ g push } fn gc []{ g commit } fn gco [@a]{ g checkout $@a } # Mercurial aliases fn h [@a]{ hg $@a } fn ha [@a]{ hg addremove $@a } fn hc []{ hg commit } fn hps []{ hg push } fn hpl []{ hg pull } fn hs []{ hg status } fn hl []{ hg log } # Aliases that overwrite other, existing commands if (has-external hub) { fn git [@a]{ hub $@a } } if (has-external exa) { fn ls [@a]{ exa $@a } } # Prompt edit:prompt = { styled (tilde-abbr $pwd) green; put "\n> " } edit:rprompt = (constantly "") # Nice welcome message if (and (has-external toilet) (has-external lolcat)) { toilet -f future "Welcome to elvish!" | lolcat -F 0.4 -S (randint 1 100) } else { echo "Welcome to elvish! To enable gay mode, install `toilet` and `lolcat`." }