Created
May 28, 2017 21:54
-
-
Save cbaggers/d7fd7603a91c40964fc7dd4f61c30fb2 to your computer and use it in GitHub Desktop.
open dired item externally
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
(defun open-file-externally () | |
"In dired, open the file named on this line." | |
(interactive) | |
(let* ((file (dired-get-filename nil t))) | |
(message "Opening %s..." file) | |
(call-process "gnome-open" nil 0 nil file) ;; switch gnome-open to whatever you prefer. xdg-open is probably sensible | |
(message "Opening %s done" file))) | |
(add-hook 'dired-mode-hook | |
(lambda () | |
(define-key dired-mode-map (kbd "<M-return>") 'open-file-externally))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment