diff --git a/spacemacs/funcs.el b/spacemacs/funcs.el index 2ff1de4fc..e3c505758 100644 --- a/spacemacs/funcs.el +++ b/spacemacs/funcs.el @@ -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))) + ))) diff --git a/spacemacs/keybindings.el b/spacemacs/keybindings.el index aefcebaa0..3780504ce 100644 --- a/spacemacs/keybindings.el +++ b/spacemacs/keybindings.el @@ -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)