diff --git a/README.org b/README.org index a8b5dd83..dfd6392d 100644 --- a/README.org +++ b/README.org @@ -537,17 +537,25 @@ I do a lot of docker management so having yaml is necessary ** File Management *** Dired +I'm making a small function in here to open files in the appropriate program using XDG defaults. This is like opening odt files in Libreoffice or mp4 files in MPV. #+begin_src emacs-lisp (use-package dired :ensure nil :straight nil + :config + (defun chris/dired-open-xdg () + "Open the file-at-point in the appropriate program" + (interactive) + (let ((file (ignore-errors (dired-get-file-for-visit)))) + (browse-url (file-truename file)))) :general (chris/leader-keys :states 'normal :keymaps 'override "od" '(dired-jump :which-key "open dired here")) (general-def 'normal dired-mode-map - "q" 'kill-this-buffer)) + "q" 'kill-this-buffer + "C-" 'chris/dired-open-xdg)) #+end_src We need a function to copy the full filename to kill-ring @@ -1304,12 +1312,12 @@ Let's add our own eshell prompt. and set the password cache to a significantly h (propertize path 'face `(:inherit org-level-1)))) (when chris/eshell-status-p (propertize (or (chris/eshell-status-display) "") 'face font-lock-comment-face)) - (propertize "\n" 'face '(:inherit org-todo :weight ultra-bold)) + (propertize "\n" 'face '(:inherit org-todo :weight ultra-bold)) " ")))) ;;; If the prompt spans over multiple lines, the regexp should match ;;; last line only. - (setq-default eshell-prompt-regexp "^ ") + (setq-default eshell-prompt-regexp "^ ") (setq eshell-destroy-buffer-when-process-dies t) (defun chris/pop-eshell () diff --git a/eshell/history b/eshell/history index 344dd00e..f52c7cde 100644 --- a/eshell/history +++ b/eshell/history @@ -109,3 +109,4 @@ ls /tmp cat /tmp/bongo-mpv.socket youtube-dl --list-formats youtube-dl --list-formats https://www.youtube.com/watch?v=ry8T67AgbUM +ls diff --git a/init.el b/init.el index b363f019..a29575b9 100644 --- a/init.el +++ b/init.el @@ -315,13 +315,20 @@ vertically." (use-package dired :ensure nil :straight nil + :config + (defun chris/dired-open-xdg () + "Open the file-at-point in the appropriate program" + (interactive) + (let ((file (ignore-errors (dired-get-file-for-visit)))) + (browse-url (file-truename file)))) :general (chris/leader-keys :states 'normal :keymaps 'override "od" '(dired-jump :which-key "open dired here")) (general-def 'normal dired-mode-map - "q" 'kill-this-buffer)) + "q" 'kill-this-buffer + "C-" 'chris/dired-open-xdg)) (defun chris/dired-yank-filename () "Get the full filename from file at point and put into kill-ring" @@ -995,12 +1002,12 @@ If on a: (propertize path 'face `(:inherit org-level-1)))) (when chris/eshell-status-p (propertize (or (chris/eshell-status-display) "") 'face font-lock-comment-face)) - (propertize "\n" 'face '(:inherit org-todo :weight ultra-bold)) + (propertize "\n" 'face '(:inherit org-todo :weight ultra-bold)) " ")))) ;;; If the prompt spans over multiple lines, the regexp should match ;;; last line only. - (setq-default eshell-prompt-regexp "^ ") + (setq-default eshell-prompt-regexp "^ ") (setq eshell-destroy-buffer-when-process-dies t) (defun chris/pop-eshell ()