nushell/config.nu
2025-03-24 17:23:07 +01:00

81 lines
2.8 KiB
Text

# config.nu
#
# Installed by:
# version = "0.102.0"
#
# This file is used to override default Nushell settings, define
# (or import) custom commands, or run any other startup tasks.
# See https://www.nushell.sh/book/configuration.html
#
# This file is loaded after env.nu and before login.nu
#
# You can open this file in your default editor using:
# config nu
#
# See `help config nu` for more options
#
# You can remove these comments if you want or leave
# them for future reference.
# ╭─────────────────────────────────────────────────────╮
# │ Define a helper function to check command existence │
# ╰─────────────────────────────────────────────────────╯
def command_exists [cmd: string] {
not (which $cmd | is-empty)
}
# ╭───────────────────────────╮
# │ oh-my-posh initialistaion │
# ╰───────────────────────────╯
if (command_exists oh-my-posh) {
if ($"~/.oh-my-posh.nu" | path exists) == true {
source ~/.oh-my-posh.nu
}
}
# ╭───────────────────────╮
# │ zoxide initialistaion │
# ╰───────────────────────╯
if (command_exists zoxide) {
if ($"~/.zoxide.nu" | path exists) {
source ~/.zoxide.nu
} else {
zoxide init nushell | save -f ~/.zoxide.nu
source ~/.zoxide.nu
}
}
alias untar = tar -xf
alias .. = cd ..
alias www = curl wttr.in/Ulm
alias ip = ip --color=always
if (command_exists git) {
alias g = git
alias gs = git status -sb
alias gsl = git status
# alias gm = git checkout main ; git merge
alias gc = git clone --recurse-submodule
alias gd = git diff
# alias gp = git submodule update --init --recursive ; git pull --recurse-submodule
# alias gsu = git submodule foreach git pull ; git submodule update --init --recursive ; git add . ; git commit -m ' update: submodules' ; echo '-- Committed changes, pushing now..' ; sleep 0.3 ; git push
alias gcm = git commit -m
alias gpu = git push --recurse-submodule=on-demand
}
$env.config.history.file_format = "sqlite"
$env.config.history.max_size = 5_000_000
$env.config.history.sync_on_enter = true
$env.config.history.isolation = false
$env.config.show_banner = true
$env.config.completions.algorithm = "prefix"
$env.config.completions.sort = "smart"
$env.config.completions.case_sensitive = false
$env.config.completions.quick = true
$env.config.error_style = "fancy"
$env.config.display_errors.exit_code = true
$env.config.datetime_format.normal = "%y.%m.%d %H:%M:%S%"