nushell icon indicating copy to clipboard operation
nushell copied to clipboard

Case insensitive history search

Open qingxiang-jia opened this issue 3 years ago • 4 comments

Question

Is it possible to search history in a case-insentitive fashion? Like, after hit CTRL+R, when I search "syu", "sudo pacman -Syu" also shows up (so "syu" also matches "Syu").

Additional context and details

I have went through the config.nu and the issues and it seems no one has mentioned this. Thanks!

qingxiang-jia avatar Nov 02 '22 13:11 qingxiang-jia

To my knowledge that is not implemented yet. Might need additional configuration on reedline

sholderbach avatar Nov 02 '22 14:11 sholderbach

I thought the default was case insensitive?

This is the default I think, maybe just different colors. From WSL. image

This is with fzf in Windows image

I'm using sqlite history so this keybinding may need tweaking for regular text

    {
      name: fuzzy_history
      modifier: control
      keycode: char_r
      mode: emacs
      event: {
        send: executehostcommand
        cmd: "commandline (history | each { |it| $it.command } | uniq | reverse | str collect (char nl) | fzf --layout=reverse --height=40% -q (commandline) | decode utf-8 | str trim)"
      }
    }

fdncred avatar Nov 02 '22 14:11 fdncred

I thought the default was case insensitive?

This is the default I think, maybe just different colors. From WSL. image

This is with fzf in Windows image

I'm using sqlite history so this keybinding may need tweaking for regular text

    {
      name: fuzzy_history
      modifier: control
      keycode: char_r
      mode: emacs
      event: {
        send: executehostcommand
        cmd: "commandline (history | each { |it| $it.command } | uniq | reverse | str collect (char nl) | fzf --layout=reverse --height=40% -q (commandline) | decode utf-8 | str trim)"
      }
    }

Here is my screenshot on Windows (not using the fzf, but the default one, it's case sensitive): image image

qingxiang-jia avatar Nov 02 '22 17:11 qingxiang-jia

To my knowledge that is not implemented yet. Might need additional configuration on reedline

Got it. Thank you. Maybe I will use @fdncred's approach.

qingxiang-jia avatar Nov 02 '22 17:11 qingxiang-jia