Refactor ido module; add ido-mode-hook
This commit is contained in:
parent
d5673cb29e
commit
fd6b85a7d2
1 changed files with 48 additions and 34 deletions
|
@ -1,50 +1,64 @@
|
|||
;;; completion/ido/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar ido-mode-hook nil
|
||||
"List of hooks to run when `ido-mode' is activated.")
|
||||
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
(use-package! ido
|
||||
:after-call pre-command-hook
|
||||
:hook (ido-mode . ido-everywhere)
|
||||
:hook (ido-mode . ido-ubiquitous-mode)
|
||||
:preface
|
||||
;; HACK `ido' is a really old package. It defines `ido-mode' manually and
|
||||
;; doesn't define a hook, so we define one for it.")
|
||||
(defadvice! +ido-run-hooks-a (&rest _)
|
||||
:after #'ido-mode
|
||||
(run-hooks 'ido-mode-hook))
|
||||
:init
|
||||
(setq ido-save-directory-list-file (concat doom-cache-dir "ido.last"))
|
||||
:config
|
||||
(pushnew! ido-ignore-files "\\`.DS_Store$" "Icon\\?$")
|
||||
(setq ido-ignore-buffers
|
||||
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer"
|
||||
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-"
|
||||
"_region_" " output\\*$" "^TAGS$" "^\*Ido")
|
||||
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*[Hh]elp" "^\\*Buffer"
|
||||
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-" "_region_"
|
||||
" output\\*$" "^TAGS$" "^\*Ido")
|
||||
ido-auto-merge-work-directories-length -1
|
||||
ido-confirm-unique-completion t
|
||||
ido-case-fold t
|
||||
ido-enable-tramp-completion nil
|
||||
ido-enable-flex-matching t
|
||||
ido-create-new-buffer 'always
|
||||
ido-enable-tramp-completion t
|
||||
ido-enable-last-directory-history t
|
||||
ido-save-directory-list-file (concat doom-cache-dir "ido.last"))
|
||||
ido-enable-flex-matching t)
|
||||
|
||||
(unless (member "\\`.DS_Store$" ido-ignore-files)
|
||||
(push "\\`.DS_Store$" ido-ignore-files)
|
||||
(push "Icon\\?$" ido-ignore-files))
|
||||
(map! :map (ido-common-completion-map ido-file-completion-map)
|
||||
"C-w" #'ido-delete-backward-word-updir
|
||||
:map ido-common-completion-map
|
||||
"C-n" #'ido-next-match
|
||||
"C-p" #'ido-prev-match
|
||||
[down] #'ido-next-match
|
||||
[up] #'ido-prev-match
|
||||
:map ido-file-completion-map
|
||||
;; Go to $HOME with ~
|
||||
"~" (λ! (if (looking-back "/" (point-min))
|
||||
(insert "~/")
|
||||
(call-interactively #'self-insert-command))))
|
||||
|
||||
(defun +ido-init-h ()
|
||||
(define-key! (ido-common-completion-map ido-completion-map ido-file-completion-map)
|
||||
"C-n" #'ido-next-match
|
||||
"C-p" #'ido-prev-match
|
||||
"<down>" #'ido-next-match
|
||||
"<up>" #'ido-prev-match
|
||||
"TAB" #'ido-exit-minibuffer
|
||||
"C-w" #'ido-delete-backward-word-updir
|
||||
;; Go to $HOME with ~
|
||||
"~" (λ! (if (looking-back "/" (point-min))
|
||||
(insert "~/")
|
||||
(call-interactively #'self-insert-command)))))
|
||||
(ido-mode +1))
|
||||
|
||||
;;
|
||||
(add-transient-hook! 'ido-setup-hook (+ido-init-h))
|
||||
|
||||
(ido-mode 1)
|
||||
(ido-everywhere 1))
|
||||
(use-package! ido-vertical-mode
|
||||
:hook (ido-mode . ido-vertical-mode)
|
||||
:config (setq ido-vertical-show-count t))
|
||||
|
||||
(after! ido
|
||||
(setq ido-vertical-show-count t)
|
||||
|
||||
(crm-custom-mode +1)
|
||||
(ido-ubiquitous-mode 1)
|
||||
(ido-sort-mtime-mode 1)
|
||||
(ido-vertical-mode 1)
|
||||
(flx-ido-mode +1))
|
||||
(use-package! ido-sort-mtime
|
||||
:hook (ido-mode . ido-sort-mtime-mode))
|
||||
|
||||
|
||||
(use-package! crm-custom
|
||||
:hook (ido-mode . crm-custom-mode))
|
||||
|
||||
|
||||
(use-package! flx-ido
|
||||
:hook (ido-mode . flx-ido-mode))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue