commit cb77c767c4fe33b6f3781189025921b39ac5eb97
parent d2c653a7032f6ee068f0a621d388ea66f9c5c9bd
Author: mokou <mokou@fastmail.com>
Date: Thu, 8 Apr 2021 13:11:22 +0200
Nicer aliases
Diffstat:
1 file changed, 35 insertions(+), 35 deletions(-)
diff --git a/private_dot_elvish/rc.elv b/private_dot_elvish/rc.elv
@@ -1,5 +1,13 @@
use path
use str
+use github.com/zzamboni/elvish-modules/iterm2
+use github.com/xiaq/edit.elv/smart-matcher
+use github.com/zzamboni/elvish-modules/alias
+
+# Initialize iTerm2 support
+iterm2:init
+
+smart-matcher:apply
# Convenience function for only setting PATH if the specified directory exists
setpath = [path]{
@@ -9,14 +17,12 @@ setpath = [path]{
}
# Set paths
+$setpath ~/n/bin
$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) {
@@ -36,43 +42,37 @@ 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"
+set-env MANPAGER "sh -c 'col -bx | bat -l man -p'"
# 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 }
+alias:new editconfig chezmoi edit ~/.elvish/rc.elv
+alias:new reload eval (cat ~/.elvish/rc.elv | slurp)
+alias:new c cargo
+alias:new cr cargo run
+alias:new cb cargo build
+alias:new cwr cargo watch -x run
+alias:new mkt cd (mktemp -d)
+alias:new czm chezmoi
# 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 }
+alias:new gs git status
+alias:new gl git log --color --graph --abbrev-commit --oneline
+alias:new gpl git pull
+alias:new gps git push
+alias:new gc git commit
# 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 }
+alias:new ha hg addremove
+alias:new hc hg commit
+alias:new hps hg push
+alias:new hpl hg pull
+alias:new hs hg status
+alias:new 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 }
-}
+alias:new ls exa
+
+# Abbreviations
+edit:small-word-abbr["g"] = "git"
+edit:small-word-abbr["h"] = "hg"
+edit:small-word-abbr["gco"] = "git checkout"
# Prompt
edit:prompt = { styled (tilde-abbr $pwd) green; put "\n> " }