selectrum: autoload +selectrum/backward-updir...
and make it independent of selectrum
This commit is contained in:
parent
336ad46c47
commit
7c313fbac2
2 changed files with 18 additions and 12 deletions
|
@ -74,6 +74,24 @@ If ARG (universal argument), include all files, even hidden or compressed ones."
|
|||
(interactive)
|
||||
(consult-line (thing-at-point 'symbol)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/backward-updir ()
|
||||
"Delete char before or go up directory for file cagetory selectrum buffers."
|
||||
(interactive)
|
||||
(let ((metadata (completion-metadata (minibuffer-contents)
|
||||
minibuffer-completion-table
|
||||
minibuffer-completion-predicate)))
|
||||
(if (and (eq (char-before) ?/)
|
||||
(eq (completion-metadata-get metadata '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))))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/embark-export-write ()
|
||||
"Export the current selectrum results to a writable buffer if possible.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue