;; DIRED: Filebrowser (straight-use-package 'dired-narrow) ;; (require 'dired-async) ;; (dired-async-mode 0) (setq dired-listing-switches "-lFahv --group-directories-first" dired-dwim-target t delete-by-moving-to-trash t dired-ls-F-marks-symlinks t dired-compress-files-alist '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o") ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o") ("\\.tar\\.xz\\'" . "tar -cf - %i | xz -c9 > %o") ("\\.tar\\.zst\\'" . "tar -cf - %i | zstd -19 -o %o") ("\\.tar\\.lz\\'" . "tar -cf - %i | lzip -c9 > %o") ("\\.tar\\.lzo\\'" . "tar -cf - %i | lzop -c9 > %o") ("\\.zip\\'" . "zip %o -r --filesync %i") ("\\.pax\\'" . "pax -wf %o %i")) dired-compress-file-suffixes '(("\\.tar\\.gz\\'" #1="" "gzip -dc %i | tar -xf -") ("\\.tar\\.xz\\'" #1# "xz -dc %i | tar -xf -") ("\\.tgz\\'" #1# "gzip -dc %i | tar -xf -") ("\\.gz\\'" #1# "gzip -d") ("\\.lz\\'" #1# "lzip -d") ("\\.Z\\'" #1# "uncompress") ("\\.z\\'" #1# "gzip -d") ("\\.dz\\'" #1# "dictunzip") ("\\.tbz\\'" ".tar" "bunzip2") ("\\.bz2\\'" #1# "bunzip2") ("\\.xz\\'" #1# "unxz") ("\\.zip\\'" #1# "7z x -aoa -o%o %i") ("\\.tar\\.zst\\'" #1# "unzstd -c %i | tar -xf -") ("\\.tzst\\'" #1# "unzstd -c %i | tar -xf -") ("\\.zst\\'" #1# "unzstd --rm") ("\\.7z\\'" #1# "7z x -aoa -o%o %i") ("\\.tar\\'" ".tgz" nil))) (add-hook 'dired-mode-hook (lambda () (dired-hide-details-mode) (when (file-remote-p dired-directory) (setq-local dired-actual-switches "-lFah")))) (put 'dired-find-alternate-file 'disabled nil) ;; ;; PEEP-DIRED: preview files in dired ;; (straight-use-package 'peep-dired) ;; ;; variables ;; (setq peep-dired-cleanup-on-disable t ;; peep-dired-cleanup-eagerly nil ;; peep-dired-enable-on-directories t) ;; ;; hooks ;; (add-hook 'peep-dired-hook 'evil-normalize-keymaps) (straight-use-package 'dired-preview) (setq dired-preview-delay 0.2 dired-preview-ignored-extensions-regexp (concat "\\." "\\(mkv\\|webm\\|mp4\\|mp3\\|ogg\\|m4a" "\\|gz\\|zst\\|tar\\|xz\\|rar\\|zip" "\\|iso\\|epub\\)")) ;; Keybindings (general-def :states 'normal :keymaps 'dired-mode-map "f" 'dired-narrow "p" 'dired-preview-mode "h" (lambda() (interactive) (find-alternate-file "..")) "l" (lambda() (interactive) (dired-find-alternate-file))) ;; DIRED-LAUNCH: Launch apps depending on file extension (straight-use-package 'dired-launch) (setq dired-launch-command '("xdg-open")) (setf dired-launch-extensions-map '(;; xml files with bpmn in it ("xopp" ("xournalpp")) ("drawio.html" ("drawio")) ("drawio" ("drawio")))) (add-hook 'dired-mode-hook (lambda () (general-def :states 'normal :keymaps 'dired-mode-map "W" 'dired-launch-command))) (provide 'a-dired)