Nicer aliases
This commit is contained in:
parent
d2c653a703
commit
cb77c767c4
1 changed files with 35 additions and 35 deletions
|
@ -1,5 +1,13 @@
|
||||||
use path
|
use path
|
||||||
use str
|
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
|
# Convenience function for only setting PATH if the specified directory exists
|
||||||
setpath = [path]{
|
setpath = [path]{
|
||||||
|
@ -9,14 +17,12 @@ setpath = [path]{
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set paths
|
# Set paths
|
||||||
|
$setpath ~/n/bin
|
||||||
$setpath /opt/homebrew/bin
|
$setpath /opt/homebrew/bin
|
||||||
$setpath ~/.rbenv/shims
|
$setpath ~/.rbenv/shims
|
||||||
$setpath ~/.rbenv/bin
|
$setpath ~/.rbenv/bin
|
||||||
$setpath ~/.cargo/bin
|
$setpath ~/.cargo/bin
|
||||||
$setpath ~/.local/bin
|
$setpath ~/.local/bin
|
||||||
$setpath ~/n/bin
|
|
||||||
$setpath ~/Library/Python/3.7/bin
|
|
||||||
$setpath ~/.asdf/shims
|
|
||||||
|
|
||||||
# Use private stuff
|
# Use private stuff
|
||||||
if (path:is-regular ~/.elvish/lib/private.elv) {
|
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 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 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 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
|
# Aliases
|
||||||
fn editconfig []{
|
alias:new editconfig chezmoi edit ~/.elvish/rc.elv
|
||||||
exec (chezmoi edit ~/.elvish/rc.elv)
|
alias:new reload eval (cat ~/.elvish/rc.elv | slurp)
|
||||||
eval (cat ~/.elvish/rc.elv | slurp)
|
alias:new c cargo
|
||||||
}
|
alias:new cr cargo run
|
||||||
fn c [@a]{ cargo $@a }
|
alias:new cb cargo build
|
||||||
fn cr [@a]{ c run $@a }
|
alias:new cwr cargo watch -x run
|
||||||
fn cb [@a]{ c build $@a }
|
alias:new mkt cd (mktemp -d)
|
||||||
fn cwr [@a]{ c watch -x run $@a }
|
alias:new czm chezmoi
|
||||||
fn mkt []{ cd (mktemp -d) }
|
|
||||||
fn czm [@a]{ chezmoi $@a }
|
|
||||||
# Git aliases
|
# Git aliases
|
||||||
fn g [@a]{ git $@a }
|
alias:new gs git status
|
||||||
fn gs []{ g status --short }
|
alias:new gl git log --color --graph --abbrev-commit --oneline
|
||||||
fn gl []{ g log --color --graph --abbrev-commit --online }
|
alias:new gpl git pull
|
||||||
fn gqp []{ g add --all; g commit; g push}
|
alias:new gps git push
|
||||||
fn gqc []{ g add --all; g commit }
|
alias:new gc git commit
|
||||||
fn gpl []{ g pull }
|
|
||||||
fn gps []{ g push }
|
|
||||||
fn gc []{ g commit }
|
|
||||||
fn gco [@a]{ g checkout $@a }
|
|
||||||
# Mercurial aliases
|
# Mercurial aliases
|
||||||
fn h [@a]{ hg $@a }
|
alias:new ha hg addremove
|
||||||
fn ha [@a]{ hg addremove $@a }
|
alias:new hc hg commit
|
||||||
fn hc []{ hg commit }
|
alias:new hps hg push
|
||||||
fn hps []{ hg push }
|
alias:new hpl hg pull
|
||||||
fn hpl []{ hg pull }
|
alias:new hs hg status
|
||||||
fn hs []{ hg status }
|
alias:new hl hg log
|
||||||
fn hl []{ hg log }
|
|
||||||
# Aliases that overwrite other, existing commands
|
# Aliases that overwrite other, existing commands
|
||||||
if (has-external hub) {
|
alias:new ls exa
|
||||||
fn git [@a]{ hub $@a }
|
|
||||||
}
|
# Abbreviations
|
||||||
if (has-external exa) {
|
edit:small-word-abbr["g"] = "git"
|
||||||
fn ls [@a]{ exa $@a }
|
edit:small-word-abbr["h"] = "hg"
|
||||||
}
|
edit:small-word-abbr["gco"] = "git checkout"
|
||||||
|
|
||||||
# Prompt
|
# Prompt
|
||||||
edit:prompt = { styled (tilde-abbr $pwd) green; put "\n> " }
|
edit:prompt = { styled (tilde-abbr $pwd) green; put "\n> " }
|
||||||
|
|
Loading…
Add table
Reference in a new issue