Held back a little by the issue that you can't really set aliases conditionally (yet?) in nushell, which is kind of fundamental to my zsh/sh alias setup. If a program exists, we add some nice aliases -- if not, we simply degrade gracefully and don't add anything. PR to track issue: https://github.com/nushell/nushell/issues/5068
59 lines
1.5 KiB
Text
59 lines
1.5 KiB
Text
alias ":q" = exit # quit nushell
|
|
|
|
def --wrapped vim [...rest] {
|
|
let cmds = which nvim vim vi | where path != ""
|
|
if ($cmds | is-empty) {
|
|
error make {msg: "No vi-like binary found."}
|
|
}
|
|
let c = $cmds | first | get path
|
|
^$c ...$rest
|
|
}
|
|
alias v = vim # start ideal vim (nvim/vim/vi)
|
|
|
|
alias l = ls # list files
|
|
alias L = ls --all # list files including hidden
|
|
alias ll = ls **/* # list files recursively
|
|
alias LL = ls --all **/* # list files recursively including hidden
|
|
# can additionally support `eza` output when
|
|
# PR https://github.com/eza-community/eza/issues/768 lands
|
|
|
|
# make directory
|
|
alias md = mkdir
|
|
# make and enter directory
|
|
def --env mcd [path: path] {
|
|
mkdir $path
|
|
cd $path
|
|
}
|
|
|
|
alias cl = clear # clear screen
|
|
|
|
# FIXME: cll functionality seems hard to accomplish?
|
|
|
|
alias myip = http get icanhazip.com # return current ip
|
|
|
|
def --env --wrapped vmm [...rest] {
|
|
if (which vifm | is-not-empty) {
|
|
let rest = $rest | each {path expand}
|
|
vifm ...$rest $env.PWD
|
|
} else {
|
|
print "No vifm executable found."
|
|
}
|
|
}
|
|
alias vm = vifm
|
|
|
|
def --wrapped iv [...rest] {
|
|
let cmds = which vimiv imv nsxiv sxiv feh | where path != ""
|
|
if ($cmds | is-empty) {
|
|
error make {msg: "No image viewer binary found."}
|
|
}
|
|
let c = $cmds | first | get path
|
|
^$c ...$rest
|
|
}
|
|
|
|
alias db = distrobox
|
|
|
|
alias sc = sc-im
|
|
|
|
# job control
|
|
# TODO: requires minimum nushell: 0.103 for job control, how to check for it?
|
|
alias fg = job unfreeze
|