rmloveland icon

Untitled

rmloveland | PRO | 04/26/24 01:53:28 PM UTC (Edited) | 0 ⭐ | 13897 👁️ | Never ⏰ | []
Lisp |

880 B

|

None

|

0 👍

/

0 👎

;; 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)

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎