First, add dired+
to dotspacemacs-additional-packages
, then...
Before user-config
in .spacemacs:
(defvar ao/v-dired-omit t
"If dired-omit-mode enabled by default. Don't setq me.")
(defun ao/dired-omit-switch ()
"This function is a small enhancement for `dired-omit-mode', which will
\"remember\" omit state across Dired buffers."
(interactive)
(if (eq ao/v-dired-omit t)
(setq ao/v-dired-omit nil)
(setq ao/v-dired-omit t))
(ao/dired-omit-caller)
(when (equal major-mode 'dired-mode)
(revert-buffer)))
(defun ao/dired-omit-caller ()
(if ao/v-dired-omit
(setq dired-omit-mode t)
(setq dired-omit-mode nil)))
(defun ao/dired-back-to-top()
"Move to the first file."
(interactive)
(beginning-of-buffer)
(dired-next-line 2))
(defun ao/dired-jump-to-bottom()
"Move to last file."
(interactive)
(end-of-buffer)
(dired-next-line -1))
Inside user-config
in spacemacs:
;; Dired
(require 'dired-x) ; Enable dired-x
(require 'dired+) ; Enable dired+
(setq-default dired-omit-files-p t) ; Don't show hidden files by default
(setq dired-omit-files (concat dired-omit-files "\\|^\\..+$\\|\\.pyc$"))
(add-hook 'dired-mode-hook 'ao/dired-omit-caller)
(define-key evil-normal-state-map (kbd "_") 'projectile-dired)
(define-key evil-normal-state-map (kbd "-") 'dired-jump)
(setq diredp-hide-details-initially-flag nil)
(advice-add 'spacemacs/find-dotfile :around 'ao/find-dotfile)
;; Make `gg' and `G' do the correct thing
(eval-after-load "dired-mode"
(evilify dired-mode dired-mode-map
"f" 'helm-find-files
"h" 'diredp-up-directory-reuse-dir-buffer
"l" 'diredp-find-file-reuse-dir-buffer
"I" 'ao/dired-omit-switch
"gg" 'ao/dired-back-to-top
"G" 'ao/dired-jump-to-bottom))
evilify
must be changed toevilified-state-evilify