Add elvish config based off of fish config

This commit is contained in:
marisa 2021-03-27 13:53:01 +01:00
parent 66954e64ec
commit 48da97b704
2 changed files with 85 additions and 0 deletions

View File

@ -53,6 +53,7 @@ set -x RUST_SRC_PATH (rustc --print sysroot)/lib/rustlib/src/rust/src
set -x XDG_CURRENT_DESKTOP Unity
set -x PYTHONPATH '/Users/lu/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/pep582' $PYTHONPATH
set -x LANG "en_US.UTF-8"
set -x TZ_LIST "Europe/Berlin;Berlin,America/New_York;US East,America/Los_Angeles;US West,Europe/London;London"
# General Aliases
alias editconfig "chezmoi edit ~/.config/fish/config.fish; and chezmoi apply; and source ~/.config/fish/config.fish"

84
private_dot_elvish/rc.elv Normal file
View File

@ -0,0 +1,84 @@
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
# 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 []{
and (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`."
}