Fzf history in nushell

This commit is contained in:
Nathan McCarty 2024-11-29 05:11:22 +00:00
parent bf10f9ad67
commit 7a323e9e48

View file

@ -424,13 +424,44 @@ $env.config = {
] ]
} }
} }
{ # {
name: history_menu # name: history_menu
modifier: control # modifier: control
keycode: char_r # keycode: char_r
mode: [emacs, vi_insert, vi_normal] # mode: [emacs, vi_insert, vi_normal]
event: { send: menu name: history_menu } # event: { send: menu name: history_menu }
} # }
{
name: fuzzy_history
modifier: control
keycode: char_r
mode: [emacs, vi_normal, vi_insert]
event: [
{
send: ExecuteHostCommand
cmd: "do {
$env.SHELL = (which bash)
commandline edit --insert (
history
| get command
| reverse
| uniq
| str join (char -i 0)
| fzf --scheme=history
--read0
--layout=reverse
--height=40%
--bind 'ctrl-/:change-preview-window(right,70%|right)'
--preview='echo -n {} | nu --stdin -c \'nu-highlight\''
# Run without existing commandline query for now to test composability
# -q (commandline)
| decode utf-8
| str trim
)
}"
}
]
}
{ {
name: help_menu name: help_menu
modifier: none modifier: none