feat(nu): nix-index & etc

This commit is contained in:
winston 2024-05-16 18:42:34 +02:00
parent 8224532f2c
commit 48024589aa
Signed by: winston
GPG key ID: 3786770EDBC2B481
3 changed files with 27 additions and 88 deletions

View file

@ -46,6 +46,11 @@ let
filename = "yarn-v4"; filename = "yarn-v4";
} }
]; ];
command-not-found = pkgs.writeShellScript "command-not-found" ''
source ${config.programs.nix-index.package}/etc/profile.d/command-not-found.sh
command_not_found_handle "$@"
'';
in in
{ {
home.packages = [ pkgs.carapace ]; home.packages = [ pkgs.carapace ];
@ -56,6 +61,12 @@ in
extraConfig = extraConfig =
'' ''
$env.config = ($env.config? | default {})
$env.config.hooks = ($env.config.hooks? | default {})
$env.config.hooks.command_not_found = {
|cmd_name| (try { ${command-not-found} $cmd_name })
}
source ${plugins}/aliases/git/git-aliases.nu source ${plugins}/aliases/git/git-aliases.nu
'' ''
+ shellAliases + shellAliases

View file

@ -14,14 +14,11 @@ $env.config = {
show_banner: false show_banner: false
ls: { ls: {
# use the LS_COLORS environment variable to colorize output
use_ls_colors: true use_ls_colors: true
# enable or disable clickable links. Your terminal has to support links.
clickable_links: true clickable_links: true
} }
rm: { rm: {
# always act as if -t was given. Can be overridden with -p
always_trash: false always_trash: false
} }
@ -35,31 +32,20 @@ $env.config = {
# a left right padding of each column in a table # a left right padding of each column in a table
padding: { left: 1, right: 1 } padding: { left: 1, right: 1 }
trim: { trim: {
# `wrapping` or `truncating` methodology: truncating # `wrapping` or `truncating`
methodology: truncating
# A strategy used by the 'wrapping' methodology
wrapping_try_keep_words: true
# A suffix used by the 'truncating' methodology
truncating_suffix: "…" truncating_suffix: "…"
} }
# show header text on separator/border line # show header text on separator/border line
header_on_separator: false header_on_separator: false
# limit data rows from top and bottom after reaching a set point # limit data rows from top and bottom after reaching a set point
# abbreviated_row_count: 10 # abbreviated_row_count: 10
} }
error_style: "fancy" # "fancy" or "plain" for screen reader-friendly error messages error_style: fancy
# datetime_format determines what a datetime rendered in the shell would look like.
# Behavior without this configuration point will be to "humanize" the datetime display,
# showing something like "a day ago."
datetime_format: { datetime_format: {
# shows up in displays of variables or other datetime's outside of tables normal: "%Y-%m-%d %I:%M:%S%p"
# normal: '%a, %d %b %Y %H:%M:%S %z' table: "%Y-%m-%d %I:%M:%S%p"
# generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format
table: '%Y-%m-%d %I:%M:%S%p'
} }
explore: { explore: {
@ -80,31 +66,20 @@ $env.config = {
} }
history: { history: {
# Session has to be reloaded for this to take effect
max_size: 100_000 max_size: 100_000
# Enable to share history between multiple sessions, else you have to close the session to write history to file
sync_on_enter: true sync_on_enter: true
# "sqlite" or "plaintext"
file_format: "plaintext" file_format: "plaintext"
# only available with sqlite file_format. true enables history isolation, false disables it. true will allow the history to be isolated to the current session using up/down arrows. false will allow the history to be shared across all sessions.
isolation: false isolation: false
} }
completions: { completions: {
# set to true to enable case-sensitive completions
case_sensitive: false case_sensitive: false
# set this to false to prevent auto-selecting completions when only one remains
quick: true quick: true
# set this to false to prevent partial filling of the prompt
partial: true partial: true
# prefix or fuzzy
algorithm: "prefix" algorithm: "prefix"
external: { external: {
# 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
enable: true enable: true
# setting it lower can improve completion performance at the cost of omitting some options max_results: 50
max_results: 100
# check 'carapace_completer' above as an example
completer: $carapace_completer completer: $carapace_completer
} }
use_ls_colors: true # set this to true to enable file/path/directory completions using LS_COLORS use_ls_colors: true # set this to true to enable file/path/directory completions using LS_COLORS
@ -171,10 +146,10 @@ $env.config = {
marker: "| " marker: "| "
type: { type: {
layout: columnar layout: columnar
columns: 4 columns: 1
# Optional value. If missing all the screen width is used to calculate column width # Optional value. If missing all the screen width is used to calculate column width
col_width: 20 # col_width: 20
col_padding: 2 # col_padding: 2
} }
style: { style: {
text: green text: green
@ -217,38 +192,6 @@ $env.config = {
selected_match_text: { attr: ur } selected_match_text: { attr: ur }
} }
} }
{
name: history_menu
only_buffer_difference: true
marker: "? "
type: {
layout: list
page_size: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
}
{
name: help_menu
only_buffer_difference: true
marker: "? "
type: {
layout: description
columns: 4
col_width: 20 # Optional value. If missing all the screen width is used to calculate column width
col_padding: 2
selection_rows: 4
description_rows: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
}
] ]
keybindings: (keybindings) keybindings: (keybindings)
} }

View file

@ -26,21 +26,6 @@ export def main [] {
] ]
} }
} }
# replaced by Atuin.sh
# {
# name: history_menu
# modifier: control
# keycode: char_r
# mode: [vi_insert, vi_normal]
# event: { send: menu name: history_menu }
# }
{
name: help_menu
modifier: none
keycode: f1
mode: [vi_insert, vi_normal]
event: { send: menu name: help_menu }
}
{ {
name: completion_previous_menu name: completion_previous_menu
modifier: shift modifier: shift
@ -179,10 +164,10 @@ export def main [] {
keycode: end keycode: end
mode: [vi_normal, vi_insert] mode: [vi_normal, vi_insert]
event: { event: {
until: [ until: [
{ send: historyhintcomplete } { send: historyhintcomplete }
{ edit: movetolineend } { edit: movetolineend }
] ]
} }
} }
{ {
@ -191,10 +176,10 @@ export def main [] {
keycode: char_e keycode: char_e
mode: [vi_normal, vi_insert] mode: [vi_normal, vi_insert]
event: { event: {
until: [ until: [
{ send: historyhintcomplete } { send: historyhintcomplete }
{ edit: movetolineend } { edit: movetolineend }
] ]
} }
} }
{ {