Skip to content

Commit

Permalink
fix: make ctrl-c equivalent to esc in :HopPattern prompt
Browse files Browse the repository at this point in the history
Pressing CTRL-C was not properly aborting :HopPattern, because it still
returned some pattern from the function. Make it equivalent to CR.
  • Loading branch information
ii14 committed Jul 9, 2022
1 parent 6bcaeb7 commit afaec06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/hop/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ local function get_input_pattern(prompt, maxchar, opts)
vim.api.nvim_echo({{prompt, 'Question'}, {pat}}, false, {})

local ok, key = pcall(vim.fn.getchar)
if not ok then break end -- Interrupted by <C-c>
if not ok then -- Interrupted by <C-c>
pat = nil
break
end

if type(key) == 'number' then
key = vim.fn.nr2char(key)
Expand Down

0 comments on commit afaec06

Please sign in to comment.