From d0cf88745d6fba663dec0bbd74a48725c94eb365 Mon Sep 17 00:00:00 2001 From: Ray Jameson <67468725+RayJameson@users.noreply.github.com> Date: Fri, 14 Jul 2023 19:40:18 +0600 Subject: [PATCH] fix: make `case_insensitive` option work if vim.o.smartcase is true Fixes #372 --- lua/hop/jump_target.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/hop/jump_target.lua b/lua/hop/jump_target.lua index 513fc43f..25855c52 100644 --- a/lua/hop/jump_target.lua +++ b/lua/hop/jump_target.lua @@ -365,12 +365,12 @@ function M.regex_by_case_searching(pat, plain_search, opts) pat = vim.fn.escape(pat, '\\/.$^~[]') end - if vim.o.smartcase then - if not starts_with_uppercase(pat) then + if opts.case_insensitive then + if vim.o.smartcase and not starts_with_uppercase(pat) then + pat = '\\c' .. pat + elseif not vim.o.smartcase then pat = '\\c' .. pat end - elseif opts.case_insensitive then - pat = '\\c' .. pat end local regex = vim.regex(pat)