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

View file

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

View file

@ -5,11 +5,13 @@
enable = true;
shellAliases = {
"em" = "emacsclient -n -r";
"emm" = "emacsclient -nw";
"mkdir" = "mkdir -pv";
"gtr" = "gtrash restore";
"rmr" = "gtrash restore";
"rm" = "gtrash put";
"lg" = "lazygit";
"cat" = "bat --plain";
};
# 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;
shellAliases = {
"em" = "emacsclient -n -r";
"emm" = "emacsclient -nw";
"gtr" = "gtrash restore";
"rmr" = "gtrash restore";
"rm" = "gtrash put";
"lg" = "lazygit";
"cat" = "bat --plain";
};
configFile.source = ./config.nu;
loginFile.text = ''
@ -22,6 +24,43 @@
};
settings = {
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 ];
};
}