Archived
1
0
Fork 0

fixup better colorization of dired

This commit is contained in:
KemoNine 2022-04-22 17:03:15 -04:00
parent 880f5a4b2b
commit bf32536579
3 changed files with 142 additions and 54 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
*.elc
orig/
**/auto-save-list
**/bookmarks
**/persp-confs
**/beancount-mode

View file

@ -4,11 +4,142 @@
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ; this goes in chemacs2 init -- DO NOT UNCOMMENT
(package-initialize) ; this goes in chemacs2 init -- DO NOT UNCOMMENT
(add-to-list 'package-selected-packages
'(helpful dired-rainbow dired-collapse dired-ranger dired-single all-the-icons-dired ido-completing-read+ diminish persp-mode modus-themes transpose-frame use-package)
'(helpful ido-completing-read+ dired-rainbow dired-rainbow-listing dired-single dash s origami diminish persp-mode modus-themes transpose-frame use-package)
)
(require 'use-package)
; helper functions
(require 'subr-x)
(setq kmn/is-termux
(string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; dired adjustments
(use-package dired-rainbow
:defer 4
:config
(dired-rainbow-define-chmod directory "#0074d9" "d.*")
(dired-rainbow-define html "#eb5286"
("css" "less" "sass" "scss" "htm" "html" "jhtm" "mht"
"eml" "mustache" "xhtml"))
(dired-rainbow-define xml "#f2d024"
("xml" "xsd" "xsl" "xslt" "wsdl" "bib" "json" "msg"
"pgn" "rss" "yaml" "yml" "rdata" "sln" "csproj"
"meta" "unity" "tres" "tscn" "import" "godot"))
(dired-rainbow-define document "#9561e2"
("docm" "doc" "docx" "odb" "odt" "pdb" "pdf" "ps"
"rtf" "djvu" "epub" "odp" "ppt" "pptx" "xls" "xlsx"
"vsd" "vsdx" "plantuml"))
(dired-rainbow-define markdown "#4dc0b5"
("org" "org_archive" "etx" "info" "markdown" "md"
"mkd" "nfo" "pod" "rst" "tex" "texi" "textfile" "txt"))
(dired-rainbow-define database "#6574cd"
("xlsx" "xls" "csv" "accdb" "db" "mdb" "sqlite" "nc"))
(dired-rainbow-define media "#de751f"
("mp3" "mp4" "MP3" "MP4" "avi" "mpeg" "mpg" "flv"
"ogg" "mov" "mid" "midi" "wav" "aiff" "flac" "mkv"))
(dired-rainbow-define image "#f66d9b"
("tiff" "tif" "cdr" "gif" "ico" "jpeg" "jpg" "png"
"psd" "eps" "svg"))
(dired-rainbow-define log "#c17d11"
("log" "log.1" "log.2" "log.3" "log.4" "log.5" "log.6"
"log.7" "log.8" "log.9"))
(dired-rainbow-define shell "#f6993f"
("awk" "bash" "bat" "fish" "sed" "sh" "zsh" "vim"))
(dired-rainbow-define interpreted "#38c172"
("py" "ipynb" "hy" "rb" "pl" "t" "msql" "mysql"
"pgsql" "sql" "r" "clj" "cljs" "cljc" "cljx" "edn"
"scala" "js" "jsx" "lua" "fnl" "gd"))
(dired-rainbow-define compiled "#6cb2eb"
("asm" "cl" "lisp" "el" "c" "h" "c++" "h++" "hpp"
"hxx" "m" "cc" "cs" "cp" "cpp" "go" "f" "for" "ftn"
"f90" "f95" "f03" "f08" "s" "rs" "active" "hs"
"pyc" "java"))
(dired-rainbow-define executable "#8cc4ff"
("com" "exe" "msi"))
(dired-rainbow-define compressed "#51d88a"
("7z" "zip" "bz2" "tgz" "txz" "gz" "xz" "z" "Z" "jar"
"war" "ear" "rar" "sar" "xpi" "apk" "xz" "tar" "rar"))
(dired-rainbow-define packaged "#faad63"
("deb" "rpm" "apk" "jad" "jar" "cab" "pak" "pk3" "vdf"
"vpk" "bsp"))
(dired-rainbow-define encrypted "#f2d024"
("gpg" "pgp" "asc" "bfe" "enc" "signature" "sig" "p12"
"pem"))
(dired-rainbow-define fonts "#f6993f"
("afm" "fon" "fnt" "pfb" "pfm" "ttf" "otf" "woff"
"woff2" "eot"))
(dired-rainbow-define partition "#e3342f"
("dmg" "iso" "bin" "nrg" "qcow" "toast" "vcd" "vmdk"
"bak"))
(dired-rainbow-define vc "#6cb2eb"
("git" "gitignore" "gitattributes" "gitmodules"))
(dired-rainbow-define config "#5040e2"
("cfg" "conf"))
(dired-rainbow-define certificate "#6cb2eb"
("cer" "crt" "pfx" "p7b" "csr" "req" "key"))
(dired-rainbow-define junk "#7F7D7D"
("DS_Store" "projectile"))
(dired-rainbow-define icloud "#e3342f" ("icloud"))
(dired-rainbow-define-chmod executable-unix "#38c172" "-.*x.*")
)
; use single buffer for nav damnit
(require 'dired-single)
(defun my-dired-init ()
"Bunch of stuff to run for dired, either immediately or when it's
loaded."
;; <add other stuff here>
(define-key dired-mode-map [remap dired-find-file]
'dired-single-buffer)
(define-key dired-mode-map [remap dired-mouse-find-file-other-window]
'dired-single-buffer-mouse)
(define-key dired-mode-map [remap dired-up-directory]
'dired-single-up-directory))
;; if dired's already loaded, then the keymap will be bound
(if (boundp 'dired-mode-map)
;; we're good to go; just add our bindings
(my-dired-init)
;; it's not loaded yet, so add our bindings to the load-hook
(add-hook 'dired-load-hook 'my-dired-init))
; icons / colors / line tunes
(add-hook 'dired-mode-hook
(lambda ()
(interactive)
(when kmn/is-termux (all-the-icons-dired-mode 1))
(hl-line-mode 1)))
(add-to-list 'load-path (expand-file-name "dired-rainbow-listing" user-emacs-directory))
(require 'dired-rainbow-listing)
(add-hook 'dired-mode-hook #'dired-rainbow-listing-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; origami config
(use-package origami
:demand
:config
(define-prefix-command 'origami-mode-map)
(define-key ctl-x-map (kbd "z") 'origami-mode-map)
(global-origami-mode)
:bind
(:map origami-mode-map
("o" . origami-open-node)
("O" . origami-open-node-recursively)
("c" . origami-close-node)
("C" . origami-close-node-recursively)
("a" . origami-toggle-node)
("t" . origami-recursively-toggle-node)
("R" . origami-open-all-nodes)
("M" . origami-close-all-nodes)
("v" . origami-show-only-node)
("k" . origami-previous-fold)
("j" . origami-forward-fold)
("x" . origami-reset)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; diminish config
(require 'diminish)
(diminish 'rainbow-mode) ; Hide lighter from mode-line
@ -110,50 +241,3 @@
(setq wg-morph-on nil) ;; switch off animation
(setq persp-autokill-buffer-on-remove 'kill-weak)
(add-hook 'window-setup-hook #'(lambda () (persp-mode 1))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; better dired behaviors
(setq dired-listing-switches "-agho --group-directories-first"
dired-omit-files "^\\.[^.].*"
dired-omit-verbose nil
dired-hide-details-hide-symlink-targets nil)
(autoload 'dired-omit-mode "dired-x")
(require 'dired-collapse)
(add-hook 'dired-load-hook
(lambda ()
(interactive)
(dired-collapse)))
(add-hook 'dired-mode-hook
(lambda ()
(interactive)
(dired-omit-mode 1)
(dired-hide-details-mode 1)
(hl-line-mode 1)))
(use-package dired-rainbow
:config
(progn
(dired-rainbow-define-chmod directory "#6cb2eb" "d.*")
(dired-rainbow-define html "#eb5286" ("css" "less" "sass" "scss" "htm" "html" "jhtm" "mht" "eml" "mustache" "xhtml"))
(dired-rainbow-define xml "#f2d024" ("xml" "xsd" "xsl" "xslt" "wsdl" "bib" "json" "msg" "pgn" "rss" "yaml" "yml" "rdata"))
(dired-rainbow-define document "#9561e2" ("docm" "doc" "docx" "odb" "odt" "pdb" "pdf" "ps" "rtf" "djvu" "epub" "odp" "ppt" "pptx"))
(dired-rainbow-define markdown "#ffed4a" ("org" "etx" "info" "markdown" "md" "mkd" "nfo" "pod" "rst" "tex" "textfile" "txt"))
(dired-rainbow-define database "#6574cd" ("xlsx" "xls" "csv" "accdb" "db" "mdb" "sqlite" "nc"))
(dired-rainbow-define media "#de751f" ("mp3" "mp4" "mkv" "MP3" "MP4" "avi" "mpeg" "mpg" "flv" "ogg" "mov" "mid" "midi" "wav" "aiff" "flac"))
(dired-rainbow-define image "#f66d9b" ("tiff" "tif" "cdr" "gif" "ico" "jpeg" "jpg" "png" "psd" "eps" "svg"))
(dired-rainbow-define log "#c17d11" ("log"))
(dired-rainbow-define shell "#f6993f" ("awk" "bash" "bat" "sed" "sh" "zsh" "vim"))
(dired-rainbow-define interpreted "#38c172" ("py" "ipynb" "rb" "pl" "t" "msql" "mysql" "pgsql" "sql" "r" "clj" "cljs" "scala" "js"))
(dired-rainbow-define compiled "#4dc0b5" ("asm" "cl" "lisp" "el" "c" "h" "c++" "h++" "hpp" "hxx" "m" "cc" "cs" "cp" "cpp" "go" "f" "for" "ftn" "f90" "f95" "f03" "f08" "s" "rs" "hi" "hs" "pyc" ".java"))
(dired-rainbow-define executable "#8cc4ff" ("exe" "msi"))
(dired-rainbow-define compressed "#51d88a" ("7z" "zip" "bz2" "tgz" "txz" "gz" "xz" "z" "Z" "jar" "war" "ear" "rar" "sar" "xpi" "apk" "xz" "tar"))
(dired-rainbow-define packaged "#faad63" ("deb" "rpm" "apk" "jad" "jar" "cab" "pak" "pk3" "vdf" "vpk" "bsp"))
(dired-rainbow-define encrypted "#ffed4a" ("gpg" "pgp" "asc" "bfe" "enc" "signature" "sig" "p12" "pem"))
(dired-rainbow-define fonts "#6cb2eb" ("afm" "fon" "fnt" "pfb" "pfm" "ttf" "otf"))
(dired-rainbow-define partition "#e3342f" ("dmg" "iso" "bin" "nrg" "qcow" "toast" "vcd" "vmdk" "bak"))
(dired-rainbow-define vc "#0074d9" ("git" "gitignore" "gitattributes" "gitmodules"))
(dired-rainbow-define-chmod executable-unix "#38c172" "-.*x.*")
))

View file

@ -41,6 +41,9 @@ EOF
cd [profile_path]
git clone https://github.com/beancount/beancount-mode.git
cd [profile_path]
git clone https://github.com/mnewt/dired-rainbow-listing
open scratch buffer. paste below into it as the contents then do `M-x ev-b RET`
``` elisp
@ -55,7 +58,6 @@ open scratch buffer. paste below into it as the contents then do `M-x ev-b RET`
dockerfile-mode
yaml-mode
go-mode
origami
rust-mode
powershell
python-mode
@ -71,12 +73,13 @@ open scratch buffer. paste below into it as the contents then do `M-x ev-b RET`
modus-themes
persp-mode
diminish
dash
s
oragami
ido-completing-read+
all-the-icons-dired
dired-single
dired-ranger
dired-collapse
dired-rainbow
dired-single
all-the-icons-dired
dired-rainbow
helpful)
"Default packages")