Skip to content

Instantly share code, notes, and snippets.

@cbaggers
Created May 28, 2017 21:54
Show Gist options
  • Save cbaggers/d7fd7603a91c40964fc7dd4f61c30fb2 to your computer and use it in GitHub Desktop.
Save cbaggers/d7fd7603a91c40964fc7dd4f61c30fb2 to your computer and use it in GitHub Desktop.
open dired item externally
(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