123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- (provide 'conf-dired)
- (require 'dired+)
- ;; dired-x load and setup
- (require 'dired-x)
- (setq-default dired-omit-files-p t)
- (setq dired-omit-files "^\\.?#\\|^\\.[^\\.]+")
- ;(setq dired-omit-files "^\\.?#\\|^\\.")
- ;; Dired mode init
- (require 'dired-details+)
- (defun dired-narrow-window ()
- "make the current dired mode window 30 chars wide"
- (interactive)
- (adjust-window-trailing-edge (selected-window) (- 30 (window-width)) t))
- (add-hook 'dired-mode-hook
- '(lambda()
- (visual-line-mode 0) ;; unwrap lines.
- (linum-mode 0) ;; turn off line numbers.
- (auto-revert-mode) ;; auto-refresh dired
- (define-key dired-mode-map [mouse-3] 'dired-maybe-insert-subdir)
- (define-key dired-mode-map (kbd "C-{") 'dired-narrow-window)
- )
- )
-
- ;; shorter dired output
- (require 'dired-details)
- (setq-default dired-details-hidden-string "--- ")
- (dired-details-install)
- ;; Move files between split panes
- (setq dired-dwim-target t)
- ;; Reload dired after making changes
- (--each '(dired-do-rename
- dired-do-copy
- dired-create-directory
- wdired-abort-changes)
- (eval `(defadvice ,it (after revert-buffer activate)
- (revert-buffer))))
-
- ;; make end-of-buffer and beginning-of-buffer behave properly
- (defun dired-back-to-top ()
- (interactive)
- (beginning-of-buffer)
- (next-line 2))
- (defun dired-jump-to-bottom ()
- (interactive)
- (end-of-buffer)
- (next-line -1))
- (add-hook 'dired-mode-hook
- (lambda ()
- (define-key dired-mode-map
- (vector 'remap 'end-of-buffer) 'dired-jump-to-bottom)
- (define-key dired-mode-map
- (vector 'remap 'beginning-of-buffer) 'dired-back-to-top)))
-
-
- (eval-after-load 'dired '(progn (require 'single-dired)))
- ;;; Load packages
- (require 'dired-details+)
- (add-hook 'dired-load-hook
- (lambda () (require 'dired-sort-menu)))
- ;;; fsdired: sort files to go to different places in dired
- (require 'fsdired)
- ;; -----------------------------------------------------------------------------
- ;;; Set the ls options
- ;; Set the ls options to put directories first
- ;; ideally by adding --group-directories-first
- ;; but long options are not currently supported so ...
- (setq dired-listing-switches "-al")
- ;; ... and hack the dired-insert-directory function to add the
- ;; --group-directories-first option:
- (defadvice dired-insert-directory
- (before my-dired-insert-directory
- (dir switches &optional file-list wildcard hdr))
- (setq switches (concat switches " --group-directories-first")))
- (ad-activate 'dired-insert-directory)
- ;; Set the face for executable files
- (defface diredp-executable-file-name
- '((t (:foreground "Red" :weight bold)))
- "*Face used for names of executable files in dired buffers."
- :group 'Dired-Plus :group 'font-lock-highlighting-faces)
- (defvar diredp-executable-file-name 'diredp-executable-file-name)
- (setq diredp-font-lock-keywords-1
- (append
- diredp-font-lock-keywords-1
- (list
- (list dired-re-exe
- `(".+"
- (dired-move-to-filename)
- nil
- (0 diredp-executable-file-name t))))))
- ;; -----------------------------------------------------------------------------
- ;;; Better cursor movement functions
- (defun dired-next-file-line ()
- "Move to the next dired line that have a file or directory name on it."
- (interactive)
- (call-interactively 'dired-next-line)
- (if (eobp)
- (dired-previous-line 1)))
- (defun dired-previous-file-line ()
- "Move to the previous dired line that have a file or directory name on it."
- (interactive)
- (call-interactively 'dired-previous-line)
- (if (not (dired-move-to-filename))
- (dired-next-line 1)))
- ;; Set buffer-local variables
- (defun my-dired-mode-hook ()
- ;; hl-line - highlight current-line
- (hl-line-mode)
- ;; Use the same buffer for visited directories
- (toggle-diredp-find-file-reuse-dir 1)
- ;; Set omit-mode by default
- (dired-omit-mode 1)
- ;; Ensure that the byte-compiled version picks-up the dired+ fonts
- (set (make-local-variable 'font-lock-defaults)
- (cons '(dired-font-lock-keywords diredp-font-lock-keywords-1)
- (cdr font-lock-defaults)))
- ;; Switch-on font-lock
- (font-lock-mode 1)
- )
- (add-hook 'dired-mode-hook 'my-dired-mode-hook)
- ;; -----------------------------------------------------------------------------
- ;;; Image-dired
- ;; Set the directory for the thumbnail images generated by image-dired
- (setq image-dired-dir (expand-file-name "~/.thumbnails/emacs"))
-
- ;;Direx
- (require 'direx-project)
- (setq direx:leaf-icon " " direx:open-icon "▾ " direx:closed-icon "▸ ")
|