Support control-r search for fish

This commit is contained in:
David Dworken 2022-10-20 23:39:56 -07:00
parent 8501e0d16c
commit 49b81bcc19
2 changed files with 14 additions and 2 deletions

View File

@ -19,5 +19,16 @@ end
# TODO: support background commands, see https://github.com/fish-shell/fish-shell/issues/3894
# TODO: control-r search is currently unsupported for fish
[ "$(hishtory config-get enable-control-r)" = true ] && echo "Sorry, hishtory does not currently support overriding control-r for fish"
function __hishtory_on_control_r
set -l tmp (mktemp -t fish.XXXXXX)
set -x init_query (commandline -b)
hishtory tquery $init_query > $tmp
set -l res $status
commandline -f repaint
if [ -s $tmp ]
commandline -r (cat $tmp)
end
rm -f $tmp
end
[ "$(hishtory config-get enable-control-r)" = true ] && bind \cr __hishtory_on_control_r

View File

@ -75,6 +75,7 @@ func main() {
if os.Getenv("HISHTORY_TEST") == "" {
fmt.Println("Importing existing shell history...")
ctx := hctx.MakeContext()
// TODO: skip doing this if this is an update
numImported, err := lib.ImportHistory(ctx, false)
lib.CheckFatalError(err)
if numImported > 0 {