feature/evil: fix :vs/:sp not focusing split w/ a file argument #552
This commit is contained in:
parent
37b2563dd1
commit
26eb33e36e
2 changed files with 34 additions and 10 deletions
|
@ -308,3 +308,34 @@ more information on modifiers."
|
|||
path file-name t t 1))))
|
||||
(replace-regexp-in-string regexp "\\1" file-name t)))
|
||||
|
||||
;;;###autoload (autoload '+evil*window-split "feature/evil/autoload/evil" nil t)
|
||||
(evil-define-command +evil*window-split (&optional count file)
|
||||
"Same as `evil-window-split', but focuses (and recenters) the new split."
|
||||
:repeat nil
|
||||
(interactive "P<f>")
|
||||
(split-window (selected-window) count
|
||||
(if evil-split-window-below 'above 'below))
|
||||
(call-interactively
|
||||
(if evil-split-window-below
|
||||
#'evil-window-up
|
||||
#'evil-window-down))
|
||||
(recenter)
|
||||
(when (and (not count) evil-auto-balance-windows)
|
||||
(balance-windows (window-parent)))
|
||||
(if file (evil-edit file)))
|
||||
|
||||
;;;###autoload (autoload '+evil*window-vsplit "feature/evil/autoload/evil" nil t)
|
||||
(evil-define-command +evil*window-vsplit (&optional count file)
|
||||
"Same as `evil-window-vsplit', but focuses (and recenters) the new split."
|
||||
:repeat nil
|
||||
(interactive "P<f>")
|
||||
(split-window (selected-window) count
|
||||
(if evil-vsplit-window-right 'left 'right))
|
||||
(call-interactively
|
||||
(if evil-vsplit-window-right
|
||||
#'evil-window-left
|
||||
#'evil-window-right))
|
||||
(recenter)
|
||||
(when (and (not count) evil-auto-balance-windows)
|
||||
(balance-windows (window-parent)))
|
||||
(if file (evil-edit file)))
|
||||
|
|
|
@ -128,16 +128,9 @@
|
|||
table)))
|
||||
(add-hook 'minibuffer-inactive-mode-hook #'+evil*fix-dabbrev-in-minibuffer)
|
||||
|
||||
;; Move to new split -- setting `evil-split-window-below' &
|
||||
;; `evil-vsplit-window-right' to non-nil mimics this, but that doesn't update
|
||||
;; window history. That means when you delete a new split, Emacs leaves you on
|
||||
;; the 2nd to last window on the history stack, which is jarring.
|
||||
;;
|
||||
;; Also recenters window on cursor in new split
|
||||
(defun +evil*window-follow (&rest _) (evil-window-down 1) (recenter))
|
||||
(advice-add #'evil-window-split :after #'+evil*window-follow)
|
||||
(defun +evil*window-vfollow (&rest _) (evil-window-right 1) (recenter))
|
||||
(advice-add #'evil-window-vsplit :after #'+evil*window-vfollow)
|
||||
;; Focus and recenter new splits
|
||||
(advice-add #'evil-window-split :override #'+evil*window-split)
|
||||
(advice-add #'evil-window-vsplit :override #'+evil*window-vsplit)
|
||||
|
||||
;; These arg types will highlight matches in the current buffer
|
||||
(evil-ex-define-argument-type buffer-match :runner +evil-ex-buffer-match)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue