diff options
Diffstat (limited to '.config/emacs/modules/bd--minibuffer.el')
-rw-r--r-- | .config/emacs/modules/bd--minibuffer.el | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/.config/emacs/modules/bd--minibuffer.el b/.config/emacs/modules/bd--minibuffer.el index 205ead0..fe2ed78 100644 --- a/.config/emacs/modules/bd--minibuffer.el +++ b/.config/emacs/modules/bd--minibuffer.el @@ -7,14 +7,21 @@ (use-package icomplete + :bind + ((:map icomplete-minibuffer-map + ("RET" . icomplete-force-complete-and-exit))) :config (setopt completing-read-function #'completing-read-default - read-file-name-function #'read-file-name-default - completion-styles '(basic - substring - initials - flex) - completions-max-height '30) + read-file-name-function #'read-file-name-default + completion-styles '(basic + substring + initials + flex) + icomplete-delay-completions-threshold 0 + icomplete-compute-delay 0.10 + icomplete-show-matches-on-no-input t + icomplete-separator " | " + completions-max-height '30) (icomplete-vertical-mode)) (use-package selector @@ -56,7 +63,7 @@ selection commands.") (take bd/navigate-recent-display-number (cl-remove-if (lambda (b) (get-buffer-window b 'visible)) - (bd/buffer-list))) + (bd/buffer-list))) :actions selector-buffer-actions)) @@ -66,7 +73,7 @@ selection commands.") :candidates (let ((proj (project-current))) (when proj - (project-files proj))) + (project-files proj))) :actions selector-file-actions)) @@ -91,8 +98,6 @@ selection commands.") (bd/selector-buffer-type "IRC" #'bd/buffer-irc-p) (bd/selector-buffer-type "Ordinary" #'bd/buffer-ordinary-p) (bd/selector-project-files) - (bd/selector-bookmarks) - (bd/selector-search) (selector-recentf-source)))) (keymap-global-set "C-x b" 'bd/navigate) @@ -101,13 +106,13 @@ selection commands.") (interactive) (let ((query (read-string "rg: "))) (defun conv (x) - (cons (car x) (cons (- (string-to-number (cadr x)) 1) (caddr x)))) + (cons (car x) (cons (- (string-to-number (cadr x)) 1) (caddr x)))) (defun all-in-file (key list) - (--map (to-candidate (cdr it)) (--filter (s-equals? key (car it)) list))) + (--map (to-candidate (cdr it)) (--filter (s-equals? key (car it)) list))) (defun to-candidate (x) - (selector-candidate-create (cdr x) :value (car x))) + (selector-candidate-create (cdr x) :value (car x))) (let* ((dir (expand-file-name (bd/get-directory-dwim))) - (result (with-temp-buffer + (result (with-temp-buffer (call-process "rg" nil t nil "-n" "-." query dir) (buffer-string))) (lines (--map (conv (s-split-up-to ":" it 2)) (--filter (not (s-blank? it)) (s-split "\n" result)))) @@ -117,7 +122,7 @@ selection commands.") :candidates (all-in-file it lines) :actions (selector-file-contents-actions it)) files))) - (when (not (null sources)) + (when (not (null sources)) (selector sources))))) (keymap-global-set "C-z s" 'bd/selector-rg)) |