8000 substitution pattern in function ack#Ack should be case-sensitive · Issue #286 · mileszs/ack.vim · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
substitution pattern in function ack#Ack should be case-sensitive #286
Open
@NewComer00

Description

@NewComer00

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 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0