67 lines
1.9 KiB
Text
67 lines
1.9 KiB
Text
let carapace_completer = {|spans|
|
|
carapace $spans.0 nushell $spans | from json
|
|
}
|
|
|
|
# The default config record. This is where much of your global configuration is setup.
|
|
$env.config = {
|
|
explore: {
|
|
status: {
|
|
warn: {bg: 'yellow', fg: 'blue'}
|
|
error: {bg: 'yellow', fg: 'blue'}
|
|
info: {bg: 'yellow', fg: 'blue'}
|
|
}
|
|
|
|
try: {
|
|
border_color: 'blue'
|
|
highlighted_color: 'white'
|
|
|
|
reactive: true
|
|
}
|
|
}
|
|
|
|
history: {
|
|
file_format: "sqlite" # "sqlite" or "plaintext"
|
|
}
|
|
completions: {
|
|
algorithm: "fuzzy" # 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 my be very slow
|
|
completer: $carapace_completer # check 'carapace_completer' above as an example
|
|
}
|
|
}
|
|
filesize: {
|
|
metric: false # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard)
|
|
}
|
|
show_banner: false
|
|
shell_integration: true
|
|
|
|
hooks: {
|
|
command_not_found: { |cmdname| (
|
|
try {
|
|
let candidates = (open $env.command_not_found_db | query db $"select package from Programs where system = '($env.NIX_SYSTEM)' and name = '($cmdname)'")
|
|
if ($candidates | is-empty) {
|
|
return null
|
|
}
|
|
let packages = ($candidates | each {|pkg| $"\tnix shell nixpkgs#($pkg.package)" } | str join "\n")
|
|
let multiple = if ($candidates | length) > 1 { " one of the following" } else { "" }
|
|
(
|
|
$"The program (ansi $env.config.color_config.shape_external)($cmdname)(ansi reset) " +
|
|
$"is not in your PATH. You can make it available in an ephemeral shell by typing($multiple):\n" +
|
|
$"($packages)"
|
|
)
|
|
}
|
|
)}
|
|
}
|
|
keybindings: [
|
|
{
|
|
name: insert_last_token
|
|
modifier: alt
|
|
keycode: char_.
|
|
mode: emacs
|
|
event: [
|
|
{ edit: InsertString, value: " !$" }
|
|
{ send: Enter }
|
|
]
|
|
}
|
|
]
|
|
}
|