Created
October 27, 2015 20:55
-
-
Save zv/51093426ab049327e220 to your computer and use it in GitHub Desktop.
Spacemacs path keybinding made easy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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