Skip to content

Jump to a predefined directory while running counsel find file

Nathan Moreau edited this page Mar 27, 2018 · 1 revision

Find yourself spamming the backspace key when running counsel-find-file to find files in a precise directory?

Here is how to to improve your workflow:

(defun ivy--cd-docs ()
  (interactive)
  (ivy--cd "~/Documents"))    
(define-key counsel-find-file-map (kbd "M-e") 'ivy--cd-docs)
  • First define a command that changes the working directory to your target directory while running counsel-find-file;
  • then binding it to the keymap in use while running the completion.