Last active
January 13, 2025 21:50
-
-
Save quantumish/643314fdbdb992af66a88fdeb3bd1ead to your computer and use it in GitHub Desktop.
Simple zoxide integration for Emacs
This file contains hidden or 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
| (require 'consult) | |
| (add-hook | |
| 'dired-mode-hook | |
| (lambda () | |
| (call-process-shell-command | |
| (format "zoxide add %s" dired-directory) nil 0))) | |
| (add-hook | |
| 'find-file-hook | |
| (lambda () | |
| (call-process-shell-command | |
| (format "zoxide add %s" (file-name-directory buffer-file-name)) | |
| nil 0))) | |
| (defun find-file-with-zoxide () | |
| (interactive) | |
| (let ((target (consult--read | |
| (consult--process-collection (lambda (x) (list "zoxide" "query" "-l" x))) | |
| :prompt "Zoxide " | |
| :require-match nil | |
| :lookup #'consult--lookup-member | |
| :require-match t | |
| :category 'file | |
| :sort nil))) | |
| (if target | |
| (let ((default-directory (concat target "/"))) | |
| (call-interactively 'find-file)) | |
| (call-interactively 'find-file)))) |
Author
Thanks for pointing this out! I just updated it to use the newer API (although I haven't read the docs very closely - let me know if you experience any weird behavior). Should work now!
Thanks. Works like a charm now. 🙏
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used to work great, however after a consult update throws the following message:
I will try to change it to the new pipeline and update here when I find time, in case it isn't updated before I do so.