Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix: make case_insensitive option work if vim.o.smartcase is true #373

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lua/hop/jump_target.lua
Original file line number Diff line number Diff line change
@@ -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)