diff --git a/src/repl.jl b/src/repl.jl index 1a353bd..c7ffd34 100644 --- a/src/repl.jl +++ b/src/repl.jl @@ -271,15 +271,19 @@ function create_keybindings() #replace search with Fzf fuzzy search D["^R"] = function (s, data, c) if VERSION >= v"1.3" && OhMyREPL.ENABLE_FZF[] - current_line = LineEdit.input_string(s) - if !isempty(current_line) - line = JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--read0", "--tiebreak=index", "--height=80%", "--query=$current_line"); - else - line = JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--read0", "--tiebreak=index", "--height=80%"); - end - if isempty(line) - line = current_line + withenv("FZF_DEFAULT_OPTS" => nothing) do + current_line = LineEdit.input_string(s) + if !isempty(current_line) + line = JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--read0", "--tiebreak=index", "--height=80%", "--query=$current_line") + else + line = JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--read0", "--tiebreak=index", "--height=80%") + end + if isempty(line) + line = current_line + end + JLFzf.insert_history_to_repl(s, line) end + rewrite_with_ANSI(s) else p = Base.active_repl.interface.modes[4] LineEdit.enter_search(s, p, true)