mileszs / ack.vim

Vim plugin for the Perl module / CLI script 'ack'
Other
3.08k stars 396 forks source link

Ignoring blank searches #178

Closed rakeshbala closed 8 years ago

rakeshbala commented 8 years ago

Is there a way to make the Ack vim plugin to ignore blank searches (or error out with no regular expression) like the ack tool?

Right now it goes into a full fledged search when I hit enter after a :Ack

ches commented 8 years ago

That's not currently possible, the behavior is that a blank search implicitly uses the current word under cursor as the search term. So "it's a feature, not a bug" 😄

Is there a particular workflow that leads to this happening frequently for you, or just typing fast and hitting Enter early by accident? Trying to understand in case I could come up with some suggestion.

I wouldn't be opposed to a pull request adding an option to disable the <cword> feature and echo an error message instead if the search is blank. It's a simple addition so I'll try to get to it myself eventually.

rakeshbala commented 8 years ago

:+1: Makes sense. I didn't realize it was doing the current word lookup. ( I was in the home directory when I did the blank searches and I guess the keywords were generic enough to return too many search results.) My bad.