Skip to content

Instantly share code, notes, and snippets.

@zv
Created October 27, 2015 20:55
Show Gist options
  • Save zv/51093426ab049327e220 to your computer and use it in GitHub Desktop.
Save zv/51093426ab049327e220 to your computer and use it in GitHub Desktop.
Spacemacs path keybinding made easy
(defun zv//initial-path-keybinding (key-file-map)
"Create leader keybindings from an alist of the form (KEYS . PATH)"
(mapc (lambda (binding)
(let* ((path (cdr binding))
(keybinding (car binding)))
(evil-leader/set-key keybinding (if (string-match "\/$" path)
;; use ido-find-file-in-dir if we're binding a directory
`(lambda () (interactive) (ido-find-file-in-dir ,path))
;; Otherwise we're looking at a file, jump directly to it
`(lambda () (interactive) (find-file-existing ,path))))))
key-file-map))
(zv//initial-path-keybinding `(("fea" . "~/Development/quad/newadmin")
("feq" . "~/Development/quad")
("fez" . ,zv-configuration-layer-directory)
("fel" . "~/Development/practice/lang")
("feg" . "~/.gnus.el")
("fzd" . "~/Development/dotfilez")
("fer" . "~/.emacs.d/.ercrc.el")
("fzo" . ,org-directory)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment