summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--completion.org29
1 files changed, 29 insertions, 0 deletions
diff --git a/completion.org b/completion.org
index c44d3e8..87dfd86 100644
--- a/completion.org
+++ b/completion.org
@@ -13,6 +13,7 @@
(add-hook 'imenu-after-jump-hook #'jao-imenu-hook))
#+end_src
* completion styles
+*** completion configuration
#+begin_src emacs-lisp
(setq tab-always-indent 'complete
read-extended-command-predicate #'command-completion-default-include-p
@@ -48,6 +49,34 @@
(jao-completion--sort-by-alpha-length elems))))
#+end_src
+*** crm indicator
+ #+begin_src emacs-lisp
+ (defun jao-completion--crm-indicator (args)
+ "Add prompt indicator to `completing-read-multiple' filter ARGS."
+ (cons (concat "[CRM] " (car args)) (cdr args)))
+ (advice-add #'completing-read-multiple
+ :filter-args #'jao-completion--crm-indicator)
+ #+end_src
+*** directory navigation
+ #+begin_src emacs-lisp
+ (defun jao-completion-backward-updir ()
+ "Delete char before point or go up a directory."
+ (interactive nil mct-minibuffer-mode)
+ (cond ((and (eq (char-before) ?/)
+ (eq (mct--completion-category) 'file))
+ (when (string-equal (minibuffer-contents) "~/")
+ (delete-minibuffer-contents)
+ (insert (expand-file-name "~/"))
+ (goto-char (line-end-position)))
+ (save-excursion
+ (goto-char (1- (point)))
+ (when (search-backward "/" (minibuffer-prompt-end) t)
+ (delete-region (1+ (point)) (point-max)))))
+ (t (call-interactively 'backward-delete-char))))
+
+ (define-key minibuffer-local-filename-completion-map (kbd "DEL")
+ #'jao-completion-backward-updir)
+ #+end_src
* orderless
#+begin_src emacs-lisp
(use-package orderless