LoginSignup
4
4

More than 5 years have passed since last update.

Emacs の dired でファイルを拡張子に適したアプリケーションで開く(Ubuntu)

Posted at

以下のコードを .emacs に記述すれば、dired で o を入力したときに、カーソル位置のファイルを Nautilus でダブルクリックしたときと同じアプリケーションで開ける。

(defun dired-open-file ()
  "In dired, open the file named on this line."
  (interactive)
  (let* ((file (dired-get-filename)))
    (message "Opening %s..." file)
    (call-process "gnome-open" nil 0 nil file)
    (message "Opening %s done" file)))

(define-key dired-mode-map "o" 'dired-open-file)
4
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4