Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Dired "native open": Use the OS-native program for opening the file
- ;; type from Dired
- (defvar dired-native-open-program nil "The OS-native program for opening files.")
- (cond ((eq system-type 'darwin)
- (setq dired-native-open-program "/usr/bin/open"))
- ((eq system-type 'gnu/linux)
- (setq dired-native-open-program "xdg-open"))
- ((eq system-type 'windows-nt)
- (setq dired-native-open-program "explorer.exe")))
- (defun dired-open-with-native-open-program ()
- "Open the marked files with the program associated with those file types."
- (interactive)
- (let ((file-list (dired-get-marked-files)))
- (dired-run-shell-command
- (dired-shell-stuff-it dired-native-open-program file-list t))))
- (define-key dired-mode-map (kbd "M-o") #'dired-open-with-native-open-program)
- (define-key locate-mode-map (kbd "M-o") #'dired-open-with-native-open-program)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement