diff --git a/layers/+distributions/spacemacs-base/funcs.el b/layers/+distributions/spacemacs-base/funcs.el index 8403ba2d1..7ea245769 100644 --- a/layers/+distributions/spacemacs-base/funcs.el +++ b/layers/+distributions/spacemacs-base/funcs.el @@ -491,12 +491,44 @@ If the universal prefix argument is used then will the windows too." (ediff-files (dotspacemacs/location) (concat dotspacemacs-template-directory ".spacemacs.template"))) -(defun spacemacs/new-empty-buffer () - "Create a new buffer called untitled()" +(defun spacemacs/new-empty-buffer (&optional split) + "Create a new buffer called untitled(). +A SPLIT argument with the value: `left', +`below', `above' or `right', opens the new +buffer in a split window." (interactive) (let ((newbuf (generate-new-buffer-name "untitled"))) + (case split + ('left (split-window-horizontally)) + ('below (spacemacs/split-window-vertically-and-switch)) + ('above (split-window-vertically)) + ('right (spacemacs/split-window-horizontally-and-switch))) (switch-to-buffer newbuf))) +(defun spacemacs/new-empty-buffer-left () + "Create a new buffer called untitled(), +in a split window to the left." + (interactive) + (spacemacs/new-empty-buffer 'left)) + +(defun spacemacs/new-empty-buffer-below () + "Create a new buffer called untitled(), +in a split window below." + (interactive) + (spacemacs/new-empty-buffer 'below)) + +(defun spacemacs/new-empty-buffer-above () + "Create a new buffer called untitled(), +in a split window above." + (interactive) + (spacemacs/new-empty-buffer 'above)) + +(defun spacemacs/new-empty-buffer-right () + "Create a new buffer called untitled(), +in a split window to the right." + (interactive) + (spacemacs/new-empty-buffer 'right)) + ;; from https://gist.github.com/timcharper/493269 (defun spacemacs/split-window-vertically-and-switch () (interactive) diff --git a/layers/+distributions/spacemacs-base/keybindings.el b/layers/+distributions/spacemacs-base/keybindings.el index 467da0f5e..c6c8a478d 100644 --- a/layers/+distributions/spacemacs-base/keybindings.el +++ b/layers/+distributions/spacemacs-base/keybindings.el @@ -124,6 +124,10 @@ "bh" 'spacemacs/home "b C-d" 'spacemacs/kill-other-buffers "b C-S-d" 'spacemacs/kill-matching-buffers-rudely + "b M-h" 'spacemacs/new-empty-buffer-left + "b M-j" 'spacemacs/new-empty-buffer-below + "b M-k" 'spacemacs/new-empty-buffer-above + "b M-l" 'spacemacs/new-empty-buffer-right "bn" 'next-buffer "bm" 'spacemacs/switch-to-messages-buffer "bN" 'spacemacs/new-empty-buffer