2017-06-08 11:47:56 +02:00
|
|
|
;;; completion/ido/config.el -*- lexical-binding: t; -*-
|
2017-02-19 18:55:11 -05:00
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
(defun +ido-init-h ()
|
2017-02-19 18:55:11 -05:00
|
|
|
(setq ido-ignore-buffers
|
|
|
|
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer"
|
|
|
|
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-"
|
|
|
|
"_region_" " output\\*$" "^TAGS$" "^\*Ido")
|
|
|
|
ido-use-faces nil
|
|
|
|
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"))
|
|
|
|
|
2018-06-03 15:01:21 +02:00
|
|
|
(unless (member "\\`.DS_Store$" ido-ignore-files)
|
|
|
|
(push "\\`.DS_Store$" ido-ignore-files)
|
|
|
|
(push "Icon\\?$" ido-ignore-files))
|
2017-02-19 18:55:11 -05:00
|
|
|
|
2018-06-03 15:01:21 +02:00
|
|
|
(define-key! (ido-common-completion-map ido-completion-map ido-file-completion-map)
|
|
|
|
"\C-n" #'ido-next-match
|
|
|
|
"\C-p" #'ido-prev-match
|
|
|
|
"\C-w" #'ido-delete-backward-word-updir
|
|
|
|
;; Go to $HOME with ~
|
|
|
|
"~" (λ! (if (looking-back "/" (point-min))
|
|
|
|
(insert "~/")
|
|
|
|
(call-interactively #'self-insert-command))))
|
2017-02-19 18:55:11 -05:00
|
|
|
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
(defun +ido--sort-mtime-a ()
|
2017-02-19 18:55:11 -05:00
|
|
|
"Sort ido filelist by mtime instead of alphabetically."
|
|
|
|
(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)
|
2017-06-08 11:47:56 +02:00
|
|
|
(cl-loop for x in ido-temp-list
|
|
|
|
if (char-equal (string-to-char x) ?.)
|
|
|
|
collect x)))
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
(advice-add #'ido-sort-mtime :override #'+ido--sort-mtime-a)
|
|
|
|
(add-hook! (ido-make-file-list ido-make-dir-list) #'ido-sort-mtime)
|
2017-02-19 18:55:11 -05:00
|
|
|
|
2018-06-03 15:01:21 +02:00
|
|
|
;;
|
|
|
|
(ido-mode 1)
|
|
|
|
(ido-everywhere 1)
|
|
|
|
(ido-ubiquitous-mode 1)
|
|
|
|
(ido-vertical-mode 1)
|
|
|
|
(flx-ido-mode +1)
|
|
|
|
(crm-custom-mode +1)
|
|
|
|
|
|
|
|
;;
|
2019-07-18 15:27:20 +02:00
|
|
|
(remove-hook 'ido-setup-hook #'+ido-init-h))
|
2018-06-03 15:01:21 +02:00
|
|
|
|
|
|
|
;;
|
2019-07-18 15:27:20 +02:00
|
|
|
(add-hook 'ido-setup-hook #'+ido-init-h)
|