achalk
achalk

Reputation: 3449

How do I define a 'no remap' alias?

Here's an example of the kind of alias definition I'm after:

Say I'm an ag user, and I want ag to pay attention to my .ignore file by default. So I add this to my .zshrc:

alias ag='ag --path-to-ignore ~/.ignore'

But I also want a second command, that acts like vanilla ag, for the rare occasions where I do want to search every single file. So I try to do this:

alias agnodotignore='ag'

It doesn't work, all this does is alias agnodotignore to ag --path-to-ignore ~/.ignore.

How can I write a 'no remap' alias definition that ignores my previous alias definition?

Upvotes: 1

Views: 84

Answers (1)

jeremysprofile
jeremysprofile

Reputation: 11435

the \ is an escape for aliases to get to the actual, un-aliased command.

alias agnodotignore='\ag'

will give you the default ag output, i.e., not the aliased version

you could also just type \ag from the command line for the same effect.

Upvotes: 3

Related Questions