From e6eda451b5eb9d36187892c53b82c733908674fc Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 29 Jul 2017 21:50:11 -0400 Subject: [PATCH] Revises custom fns for evil window splitting --- configs/shared/.emacs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/configs/shared/.emacs b/configs/shared/.emacs index 2c40aca45..b8104f2a3 100644 --- a/configs/shared/.emacs +++ b/configs/shared/.emacs @@ -347,6 +347,26 @@ (define-key dired-mode-map (kbd "C-l") nil)) +(defun wc/evil-window-split-down () + "Convenience function that does 3 things: 1. creates a horizontal split (downward),2. Center both the previous window and the newly created window,3. Moves (downward) to the newly created window." + (interactive) + (evil-window-split-down) + (call-interactively 'evil-window-up) + (call-interactively 'evil-scroll-line-to-center) + (call-interactively 'evil-window-down) + (call-interactively 'evil-scroll-line-to-center)) + + +(defun wc/evil-window-split () + "Convenience function that does 3 things: 1. creates a horizontal split (upward),2. Center both the previous window and the newly created window,3. Moves (upward) to the newly created window." + (interactive) + (evil-window-split) + (call-interactively 'evil-scroll-line-to-center) + (call-interactively 'evil-window-down) + (call-interactively 'evil-scroll-line-to-center) + (call-interactively 'evil-window-up)) + + ;; Evil Settings (use-package evil :ensure t @@ -383,15 +403,11 @@ ("M-." . nil) ("s" . nil) ("C-p" . nil) - ("C-h" . evil-window-left) - ("C-l" . evil-window-right) - ("C-k" . evil-window-up) - ("C-j" . evil-window-down) ("g c" . comment-or-uncomment-region) ("s h" . evil-window-vsplit) ("s l" . evil-window-vsplit-right) - ("s k" . evil-window-split) - ("s j" . evil-window-split-down) + ("s k" . wc/evil-window-split) + ("s j" . wc/evil-window-split-down) ("H" . evil-first-non-blank) ("L" . evil-end-of-line) ("" . evil-window-increase-width)