Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

substitution pattern in function ack#Ack should be case-sensitive #286

Open
NewComer00 opened this issue Dec 2, 2024 · 0 comments
Open

Comments

@NewComer00
Copy link

Plugin Version

  • Vim 9.0.749
  • mileszs/ack.vim 36e40f9

Bug Reproduction

.vimrc

set ignorecase
let g:ackprg = 'ag --vimgrep --hidden --ignore .git'

Input command in Vim

:AckFile! filename

Error appeared in Quickfix List

ag: invalid option -- 'd'

Expected behavior

No error appears.

Possible Cause

When set ignorecase is specified in .vimrc, the substitution pattern in function ack#Ack will also become case-insensitive.

			*'ignorecase'* *'ic'* *'noignorecase'* *'noic'*
'ignorecase' 'ic'	boolean	(default off)
			global
	Ignore case in search patterns.  Also used when searching in the tags
	file.
	Also see 'smartcase'.
	Can be overruled by using "\c" or "\C" in the pattern, see
	|/ignorecase|.

The -h in --hidden from the value of g:ackprg will be substituted by '', leaving a wrong-shaped command ag --vimgrep -idden --ignore .git.

ack.vim/autoload/ack.vim

Lines 28 to 31 in 36e40f9

if s:SearchingFilepaths()
let l:grepprg = substitute(l:grepprg, '-H\|--column', '', 'g')
let l:grepformat = '%f'
endif

Fix

Append \C to the pattern

 if s:SearchingFilepaths() 
   let l:grepprg = substitute(l:grepprg, '-H\|--column\C', '', 'g') 
   let l:grepformat = '%f' 
 endif 
NewComer00 added a commit to NewComer00/ack.vim that referenced this issue Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant