Refactor minibuffer bindings
+ conform their function names to naming conventions + place ivy-specific version in ivy autoloads
This commit is contained in:
parent
2cd0818801
commit
41a288d21d
4 changed files with 22 additions and 17 deletions
|
@ -1,30 +1,25 @@
|
||||||
;;; ../core/autoload/minibuffer.el
|
;;; ../core/autoload/minibuffer.el
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-minibuffer-kill-word ()
|
(defun doom/minibuffer-kill-word ()
|
||||||
"Kill a word, backwards, but only if the cursor is after
|
"Kill a word, backwards, but only if the cursor is after
|
||||||
`minibuffer-prompt-end', to prevent the 'Text is read-only' warning from
|
`minibuffer-prompt-end', to prevent the 'Text is read-only' warning from
|
||||||
monopolizing the minibuffer."
|
monopolizing the minibuffer."
|
||||||
(interactive)
|
(interactive)
|
||||||
(call-interactively
|
(when (> (point) (minibuffer-prompt-end))
|
||||||
(cond ((> (point) (minibuffer-prompt-end))
|
(call-interactively #'backward-kill-word)))
|
||||||
'backward-kill-word)
|
|
||||||
((and (fboundp 'evil-ex-p) (evil-ex-p))
|
|
||||||
'evil-ex-delete-backward-char)
|
|
||||||
(t
|
|
||||||
'ivy-backward-delete-char))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-minibuffer-kill-line ()
|
(defun doom/minibuffer-kill-line ()
|
||||||
"Kill the entire line, but only if the cursor is after
|
"Kill the entire line, but only if the cursor is after
|
||||||
`minibuffer-prompt-end', to prevent the 'Text is read-only' warning from
|
`minibuffer-prompt-end', to prevent the 'Text is read-only' warning from
|
||||||
monopolizing the minibuffer."
|
monopolizing the minibuffer."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (> (point) (minibuffer-prompt-end))
|
(when (> (point) (minibuffer-prompt-end))
|
||||||
(call-interactively 'backward-kill-sentence)))
|
(call-interactively #'backward-kill-sentence)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-minibuffer-undo ()
|
(defun doom/minibuffer-undo ()
|
||||||
"Undo an edit in the minibuffer without throwing errors."
|
"Undo an edit in the minibuffer without throwing errors."
|
||||||
(interactive)
|
(interactive)
|
||||||
(ignore-errors (call-interactively 'undo)))
|
(ignore-errors (call-interactively #'undo)))
|
||||||
|
|
|
@ -228,3 +228,13 @@ counsel-rg)."
|
||||||
(when (doom-popup-p)
|
(when (doom-popup-p)
|
||||||
(doom/popup-close))
|
(doom/popup-close))
|
||||||
(ivy-resume))
|
(ivy-resume))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +ivy/backward-kill-word ()
|
||||||
|
"Kill a word backwards, but only if cursor is after `minibuffer-prompt-end',
|
||||||
|
to prevent the 'Text is read-only' warning from monopolizing the minibuffer."
|
||||||
|
(interactive)
|
||||||
|
(call-interactively
|
||||||
|
(if (> (point) (minibuffer-prompt-end))
|
||||||
|
#'backward-kill-word
|
||||||
|
#'ivy-backward-delete-char)))
|
||||||
|
|
|
@ -48,8 +48,8 @@ session)."
|
||||||
"C-k" #'ivy-previous-line
|
"C-k" #'ivy-previous-line
|
||||||
"C-j" #'ivy-next-line
|
"C-j" #'ivy-next-line
|
||||||
"C-l" #'ivy-alt-done
|
"C-l" #'ivy-alt-done
|
||||||
"C-w" #'doom-minibuffer-kill-word
|
"C-w" #'+ivy/backward-kill-word
|
||||||
"C-u" #'doom-minibuffer-kill-line
|
"C-u" #'doom/minibuffer-kill-line
|
||||||
"C-b" #'backward-word
|
"C-b" #'backward-word
|
||||||
"C-f" #'forward-word)
|
"C-f" #'forward-word)
|
||||||
|
|
||||||
|
|
|
@ -384,11 +384,11 @@
|
||||||
|
|
||||||
(:map (evil-ex-completion-map evil-ex-search-keymap read-expression-map)
|
(:map (evil-ex-completion-map evil-ex-search-keymap read-expression-map)
|
||||||
"C-a" #'move-beginning-of-line
|
"C-a" #'move-beginning-of-line
|
||||||
"C-w" #'doom-minibuffer-kill-word
|
"C-w" #'doom/minibuffer-kill-word
|
||||||
"C-u" #'doom-minibuffer-kill-line
|
"C-u" #'doom/minibuffer-kill-line
|
||||||
"C-b" #'backward-word
|
"C-b" #'backward-word
|
||||||
"C-f" #'forward-word
|
"C-f" #'forward-word
|
||||||
"M-z" #'doom-minibuffer-undo)
|
"M-z" #'doom/minibuffer-undo)
|
||||||
|
|
||||||
(:after view
|
(:after view
|
||||||
(:map view-mode-map "<escape>" #'View-quit-all)))
|
(:map view-mode-map "<escape>" #'View-quit-all)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue