Currently I have a short cut to call the function 'helm-ag' (Using evil-leader)

 (evil-leader/set-leader ".")
 (evil-leader/set-key "g" 'helm-ag)

When 'helm-ag' is called with the Universal-argument (Ctrl - U) it allows me to choose in which directory I'd like to run the command. I use this all the time so I'd like to create a permanent short to specifically run the 'helm-ag' with the universal argument.

I've tried this:

(evil-leader/set-key "g" '(lambda () (interactive)(universal-argument)(helm-ag))

But it doesn't work. Any ideas?



You need:

 (lambda ()
   (setq current-prefix-arg '(4))
  • You're right. Please update your answer with the complete command and I'll be glad to mark it as the right answer. (evil-leader/set-key "g" '(lambda () (interactive)(setq current-prefix-arg '(4))(helm-ag))) – RafaelGP Feb 19 '15 at 13:57
  • I haven't tried but the following should also work: (lambda () (interactive) (helm-ag 4)). – Kaushal Modi Feb 19 '15 at 14:06
  • 2
    @kaushalmodi, it doesn't since helm-ag literally checks for current-prefix-arg. – abo-abo Feb 19 '15 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.