2023-04-25 09:48:32 +02:00
let carapace_completer = {|spans|
carapace $spans.0 nushell $spans | from json
}
2023-03-31 20:48:53 +02:00
# The default config record. This is where much of your global configuration is setup.
2023-08-19 19:38:39 +02:00
$env.config = {
2023-03-31 20:48:53 +02:00
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
2023-04-25 09:48:32 +02:00
completer: $carapace_completer # check 'carapace_completer' above as an example
2023-03-31 20:48:53 +02:00
}
}
filesize: {
metric: false # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard)
}
show_banner: false
hooks: {
2023-04-19 10:58:03 +02:00
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
}
2023-07-04 20:25:47 +02:00
let packages = ($candidates | each {|pkg| $"\tnix shell nixpkgs#($pkg.package)" } | str join "\n")
2023-04-19 10:58:03 +02:00
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)"
)
}
)}
2023-03-31 20:48:53 +02:00
}
keybindings: [
{
name: insert_last_token
modifier: alt
keycode: char_.
mode: emacs
event: [
2023-04-06 10:00:23 +02:00
{ edit: InsertString, value: " !$" }
2023-03-31 20:48:53 +02:00
{ send: Enter }
]
}
]
2023-11-01 09:31:00 +01:00
}