nushell stuff again

This commit is contained in:
Matt Nish-Lapidus 2025-06-30 11:52:10 -04:00
parent fbd6656d80
commit 62ff7c5bcf
5 changed files with 53 additions and 14 deletions

12
flake.lock generated
View file

@ -541,11 +541,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751239699, "lastModified": 1751296747,
"narHash": "sha256-zA1uUdAq3c26fHm26xMWMuF5COhI18EzaH7az/P2OWM=", "narHash": "sha256-/nHOfmB0C972nYX0xVF0zWmbt8ooA9TCczfeKHNvwqI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "f6deff178cc4d6049d30785dbfc831e6c6e3a219", "rev": "0f21ed5182a158d2f84e9136f6bf8539fd9a6890",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1578,11 +1578,11 @@
"rust-overlay": "rust-overlay_3" "rust-overlay": "rust-overlay_3"
}, },
"locked": { "locked": {
"lastModified": 1751272045, "lastModified": 1751296710,
"narHash": "sha256-4h+pRl1IxnvS3jPqkommNFMn9alzNEAW99v6vdBlPkI=", "narHash": "sha256-SWKkSaqzVmHi+AnGc706tkvqobDMyYnXifeLTb//pnw=",
"owner": "sxyazi", "owner": "sxyazi",
"repo": "yazi", "repo": "yazi",
"rev": "5a66559d1ca53db3869384a8039bbe82a2ca2dbd", "rev": "4ff7dae7211a53c3d60f512a39d12425a1b9496c",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -94,9 +94,14 @@
television television
bash-env-json bash-env-json
bash-env-nushell bash-env-nushell
nufmt
]; ];
programs = { programs = {
carapace = {
enable = true;
};
bash = { bash = {
enable = true; enable = true;
}; };

View file

@ -5,11 +5,13 @@
enable = true; enable = true;
shellAliases = { shellAliases = {
"em" = "emacsclient -n -r"; "em" = "emacsclient -n -r";
"emm" = "emacsclient -nw";
"mkdir" = "mkdir -pv"; "mkdir" = "mkdir -pv";
"gtr" = "gtrash restore"; "gtr" = "gtrash restore";
"rmr" = "gtrash restore"; "rmr" = "gtrash restore";
"rm" = "gtrash put"; "rm" = "gtrash put";
"lg" = "lazygit"; "lg" = "lazygit";
"cat" = "bat --plain";
}; };
# change fzf variable search to C-M-v # change fzf variable search to C-M-v

View file

@ -1,8 +1 @@
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 {
if ($in | path exists) {$'"($in | path expand --no-symlink | str replace --all "\"" "\\\"" )"'} else {$in}
}
}

View file

@ -5,10 +5,12 @@
enable = true; enable = true;
shellAliases = { shellAliases = {
"em" = "emacsclient -n -r"; "em" = "emacsclient -n -r";
"emm" = "emacsclient -nw";
"gtr" = "gtrash restore"; "gtr" = "gtrash restore";
"rmr" = "gtrash restore"; "rmr" = "gtrash restore";
"rm" = "gtrash put"; "rm" = "gtrash put";
"lg" = "lazygit"; "lg" = "lazygit";
"cat" = "bat --plain";
}; };
configFile.source = ./config.nu; configFile.source = ./config.nu;
loginFile.text = '' loginFile.text = ''
@ -22,6 +24,43 @@
}; };
settings = { settings = {
show_banner = false; show_banner = false;
ls = { clickable_links = true; };
completions = {
case_sensitive = false;
quick = true;
partial = true;
algorithm = "fuzzy";
external = {
enable = true;
max_results = 100;
};
};
}; };
extraConfig = ''
$env.config.completions.external.completer = $fish_completer
'';
extraEnv = ''
let fish_completer = {|spans|
let completions = fish --command $'complete "--do-complete=($spans | str join " ")"'
| from tsv --flexible --noheaders --no-infer
| rename value description
let has_paths = ($completions | any {|row| $row.value =~ '/' or $row.value =~ '\\.\\w+$' or $row.value =~ ' '})
if $has_paths {
$completions | update value {|row|
if $row.value =~ ' ' {
$"'($row.value)'" # Wrap in single quotes
} else {
$row.value
}
}
} else {
$completions
}
}
'';
# plugins = [ pkgs.nushellPlugins.skim ];
}; };
} }