From 3553b103c8a98e123845bdb81bc273f4145fb0c7 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Wed, 24 Dec 2014 00:08:56 -0500 Subject: [PATCH] Fixes #327 Add binding for window split + move to window --- spacemacs/keybindings.el | 26 ++++++++++++++++++++++---- spacemacs/packages.el | 8 ++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/spacemacs/keybindings.el b/spacemacs/keybindings.el index 1b90e0d8e..7124dee07 100644 --- a/spacemacs/keybindings.el +++ b/spacemacs/keybindings.el @@ -126,7 +126,24 @@ "q s" 'spacemacs/save-buffers-kill-emacs "q q" 'spacemacs/kill-emacs) ;; window --------------------------------------------------------------------- -;; (evil-leader/set-key "wb" 'evenly-split-window-right) +(defun split-window-below-and-focus () + "Split the window vertically and focus the new window." + (interactive) + (split-window-below) + (windmove-down) + (when (and (boundp 'golden-ratio-mode) + (symbol-value golden-ratio-mode)) + (golden-ratio))) + +(defun split-window-right-and-focus () + "Split the window horizontally and focus the new window." + (interactive) + (split-window-right) + (windmove-right) + (when (and (boundp 'golden-ratio-mode) + (symbol-value golden-ratio-mode)) + (golden-ratio))) + (evil-leader/set-key "w2" 'layout-double-columns "w3" 'layout-triple-columns @@ -144,15 +161,16 @@ "wM" 'toggle-maximize-centered-buffer "wm" 'toggle-maximize-buffer "wo" 'other-frame - "wr" 'rotate-windows - "wR" 'rotate-windows-backward + "wr" 'spacemacs/resize-window-overlay-map + "wR" 'rotate-windows ;; "wv" 'evenly-split-window-below) "ws" 'split-window-below + "wS" 'split-window-below-and-focus "w-" 'split-window-below - "wS" 'spacemacs/resize-window-overlay-map "wU" 'winner-redo "wu" 'winner-undo "wv" 'split-window-right + "wV" 'split-window-right-and-focus "w/" 'split-window-right "ww" 'other-window) ;; text ----------------------------------------------------------------------- diff --git a/spacemacs/packages.el b/spacemacs/packages.el index 563146b00..5cd6f1f38 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -1009,10 +1009,10 @@ determine the state to enable when escaping from the insert state.") (progn (setq golden-ratio-extra-commands (append golden-ratio-extra-commands - '(evil-window-left - evil-window-right - evil-window-up - evil-window-down + '(windmove-left + windmove-right + windmove-up + windmove-down select-window-0 select-window-1 select-window-2