Use fzf for history and carapace for completion

This commit is contained in:
2025-09-07 16:12:28 +08:00
parent 9d8a37010e
commit ce4aad3e04

View File

@@ -24,6 +24,39 @@ in
$env.config.buffer_editor = "nvim"
$env.config.show_banner = false
$env.EDITOR = "nvim"
$env.config.history.file_format = "sqlite"
$env.config.history.max_size = 5_000_000
$env.config.keybindings = [
{
name: fuzzy_history
modifier: control
keycode: char_r
mode: [emacs, vi_normal, vi_insert]
event: [
{
send: ExecuteHostCommand
cmd: "let result = (
history
| get command
| uniq
| reverse
| str join (char -i 0)
| fzf --scheme=history
--read0
--height=40%
--bind=ctrl-r:toggle-sort
--highlight-line
--query=(commandline | str substring 0..(commandline get-cursor))
+m
| complete
); if ($result.exit_code == 0) { commandline edit ($result.stdout | str trim) }"
}
]
}
];
'';
shellAliases = {
lg = "lazygit";
@@ -34,6 +67,10 @@ in
jp = "jj git push";
};
};
carapace = {
enable = true;
enableNushellIntegration = true;
};
nix-your-shell = {
enable = true;
enableNushellIntegration = true;