added open file in external application function

This commit is contained in:
Daniel Wu 2015-01-10 10:13:09 -05:00 committed by syl20bnr
parent a1fa06a230
commit d719b78e93
2 changed files with 12 additions and 0 deletions

View file

@ -840,3 +840,14 @@ If ASCII si not provided then UNICODE is used instead."
(save-excursion
(evil-end-of-line)
(eval-last-sexp nil)))
(defun spacemacs/open-in-external-app ()
"Open current file in external application."
(interactive)
(let ((file-path (buffer-file-name)))
(cond
((system-is-mswindows) (w32-shell-execute "open" (replace-regexp-in-string "/" "\\" file-path)))
((system-is-mac) (shell-command (format "open \"%s\"" file-path)))
((system-is-linux) (let ((process-connection-type nil))
(start-process "" nil "xdg-open" file-path)))
)))

View file

@ -72,6 +72,7 @@
"fec" 'find-contrib-file
"fed" 'find-dotfile
"fev" 'spacemacs/display-and-copy-version
"fo" 'spacemacs/open-in-external-app
"fS" 'evil-write-all
"fs" 'evil-write
"fy" 'show-and-copy-buffer-filename)