Fix and improve ido module

- ido will actually be loaded at startup - I'm hoping there's a better
  way to optimize this.
- ido-sort-mtime-mode was fixed
- Up/Down were added to get closer to
  `(setq ido-vertical-define-keys 'C-n-C-p-up-down-left-right)`
- Faces were re-enabled
- The number of results are now displayed with ido
This commit is contained in:
Kaleb Elwert 2020-03-18 02:36:33 -07:00
parent 4b20c7206e
commit d5673cb29e
2 changed files with 28 additions and 36 deletions

View file

@ -1,11 +1,13 @@
;;; completion/ido/config.el -*- lexical-binding: t; -*- ;;; completion/ido/config.el -*- lexical-binding: t; -*-
(defun +ido-init-h () (use-package! ido
:after-call pre-command-hook
:config
(setq ido-ignore-buffers (setq ido-ignore-buffers
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer" '("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer"
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-" "^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-"
"_region_" " output\\*$" "^TAGS$" "^\*Ido") "_region_" " output\\*$" "^TAGS$" "^\*Ido")
ido-use-faces nil ido-auto-merge-work-directories-length -1
ido-confirm-unique-completion t ido-confirm-unique-completion t
ido-case-fold t ido-case-fold t
ido-enable-tramp-completion nil ido-enable-tramp-completion nil
@ -19,41 +21,30 @@
(push "\\`.DS_Store$" ido-ignore-files) (push "\\`.DS_Store$" ido-ignore-files)
(push "Icon\\?$" ido-ignore-files)) (push "Icon\\?$" ido-ignore-files))
(defun +ido-init-h ()
(define-key! (ido-common-completion-map ido-completion-map ido-file-completion-map) (define-key! (ido-common-completion-map ido-completion-map ido-file-completion-map)
"\C-n" #'ido-next-match "C-n" #'ido-next-match
"\C-p" #'ido-prev-match "C-p" #'ido-prev-match
"\C-w" #'ido-delete-backward-word-updir "<down>" #'ido-next-match
"<up>" #'ido-prev-match
"TAB" #'ido-exit-minibuffer
"C-w" #'ido-delete-backward-word-updir
;; Go to $HOME with ~ ;; Go to $HOME with ~
"~" (λ! (if (looking-back "/" (point-min)) "~" (λ! (if (looking-back "/" (point-min))
(insert "~/") (insert "~/")
(call-interactively #'self-insert-command)))) (call-interactively #'self-insert-command)))))
(defadvice! +ido--sort-mtime-a ()
"Sort ido filelist by mtime instead of alphabetically."
:override #'ido-sort-mtime
(setq ido-temp-list
(sort ido-temp-list
(lambda (a b)
(time-less-p
(sixth (file-attributes (concat ido-current-directory b)))
(sixth (file-attributes (concat ido-current-directory a)))))))
(ido-to-end ;; move . files to end (again)
(cl-loop for x in ido-temp-list
if (char-equal (string-to-char x) ?.)
collect x)))
(add-hook! '(ido-make-file-list-hook ido-make-dir-list-hook)
#'ido-sort-mtime)
;; ;;
(add-transient-hook! 'ido-setup-hook (+ido-init-h))
(ido-mode 1) (ido-mode 1)
(ido-everywhere 1) (ido-everywhere 1))
(ido-ubiquitous-mode 1)
(ido-vertical-mode 1) (after! ido
(flx-ido-mode +1) (setq ido-vertical-show-count t)
(crm-custom-mode +1) (crm-custom-mode +1)
(ido-ubiquitous-mode 1)
;; (ido-sort-mtime-mode 1)
(remove-hook 'ido-setup-hook #'+ido-init-h)) (ido-vertical-mode 1)
(flx-ido-mode +1))
;;
(add-hook 'ido-setup-hook #'+ido-init-h)

View file

@ -3,5 +3,6 @@
(package! flx-ido :pin "17f5c9cb2a") (package! flx-ido :pin "17f5c9cb2a")
(package! ido-completing-read+ :pin "74861eabd0") (package! ido-completing-read+ :pin "74861eabd0")
(package! ido-sort-mtime :pin "f638ff0c92")
(package! ido-vertical-mode :pin "16c4c1a112") (package! ido-vertical-mode :pin "16c4c1a112")
(package! crm-custom :pin "f1aaccf643") (package! crm-custom :pin "f1aaccf643")