Files
df/tree/.config/nushell/config.nu.tpl
T
2026-08-28 14:24:22 +02:00

74 lines
2.4 KiB
Smarty

let fish_completer = {|spans|
fish --command $"complete '--do-complete=($spans | str replace --all "'" "\\'" | str join ' ')'"
| from tsv --flexible --noheaders --no-infer
| rename value description
| update value {|row|
let value = $row.value
let need_quote = ['\' ',' '[' ']' '(' ')' ' ' '\t' "'" '"' "`"] | any {$in in $value}
if ($need_quote and ($value | path exists)) {
let expanded_path = if ($value starts-with ~) {$value | path expand --no-symlink} else {$value}
$'"($expanded_path | str replace --all "\"" "\\\"")"'
} else {$value}
}
}
$env.config.show_banner = false
$env.config.edit_mode = "helix"
$env.config.completions = {
case_sensitive: false # set to true to enable case-sensitive completions
quick: true # set this to false to prevent auto-selecting completions when only one remains
partial: true # set this to false to prevent partial filling of the prompt
algorithm: "prefix" # prefix or fuzzy
external: {
enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow
max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options
completer: $fish_completer
}
}
source theme.nu
$env.color_config = $color_config # sourced from theme.nu
$env.config.ls.use_ls_colors = true # use the LS_COLORS environment variable to colorize output
alias grep = rg
alias find = fd
alias cat = bat
alias e = nvim
alias gd = git diff
alias ga = git add
alias gap = git add --patch
alias gst = git status
alias gc = git commit
alias gl = git pull
alias gp = git push
alias gpu = git push -u origin
alias gsta = git stash push
alias gstp = git stash pop
alias gw = git switch
alias gr = git restore
alias grp = git restore --patch
alias lg = lazygit
alias bt = bluetoothctl
alias d = cd ~/.config/dotfiles/tree
alias xo = xdg-open
# random scripts
source ~/.local/nu/readelf.nu
source ~/.local/nu/mullvad.nu
source ~/.local/nu/git.nu
source ~/.local/nu/tailscale.nu
{% if os == "darwin" %}
source ~/.local/nu/macos.nu
{% end %}
# init zoxide
source ~/.cache/zoxide.nu
# init starship prompt
source ~/.cache/starship/init.nu
# external completions
source ~/.config/nushell/git-completions.nu
source ~/.config/nushell/cargo-completions.nu