selectrum: improve file category commands...
now when pressing backspace on `/`, the input will go up one directory.
This commit is contained in:
parent
e181318885
commit
6dfc32441d
2 changed files with 17 additions and 5 deletions
|
@ -14,9 +14,24 @@
|
|||
(defadvice! +selectrum-refresh-on-cycle (&rest _)
|
||||
:after 'marginalia-cycle
|
||||
(when (bound-and-true-p selectrum-mode) (selectrum-exhibit)))
|
||||
|
||||
(defun +selectrum/backward-updir ()
|
||||
"Delete char before or go up directory for file cagetory selectrum buffers."
|
||||
(interactive)
|
||||
(if (and (eq (char-before) ?/)
|
||||
(eq (selectrum--get-meta 'category) 'file))
|
||||
(let ((new-path (minibuffer-contents)))
|
||||
(delete-region (minibuffer-prompt-end) (point-max))
|
||||
(insert (abbreviate-file-name
|
||||
(file-name-directory
|
||||
(directory-file-name
|
||||
(expand-file-name new-path))))))
|
||||
(call-interactively 'backward-delete-char)))
|
||||
|
||||
(map! :map selectrum-minibuffer-map
|
||||
"C-o" #'embark-act
|
||||
"C-c C-o" #'embark-export))
|
||||
"C-o" #'embark-act
|
||||
"C-c C-o" #'embark-export
|
||||
[backspace] #'+selectrum/backward-updir))
|
||||
|
||||
(use-package! selectrum-prescient
|
||||
:when (featurep! +prescient)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue