(defun split-window-func-with-other-buffer (split-function)
  (lexical-let ((s-f split-function))
    (lambda ()
      (interactive)
      (funcall s-f)
      (set-window-buffer (next-window) (other-buffer)))))

(global-set-key "\C-x2" (split-window-func-with-other-buffer 'split-window-vertically))
(global-set-key "\C-x3" (split-window-func-with-other-buffer 'split-window-horizontally))

(defun split-window-horizontally-instead ()
  (interactive)
  (save-excursion
    (delete-other-windows)
    (funcall (split-window-func-with-other-buffer 'split-window-horizontally))))

(global-set-key "\C-x|" 'split-window-horizontally-instead)


(provide 'init-window-split)

(defun split-window-func-with-other-buffer (split-function)
  (lexical-let ((s-f split-function))
    (lambda ()
      (interactive)
      (funcall s-f)
      (set-window-buffer (next-window) (other-buffer)))))

(global-set-key "\C-x2" (split-window-func-with-other-buffer 'split-window-vertically))
(global-set-key "\C-x3" (split-window-func-with-other-buffer 'split-window-horizontally))

(defun split-window-horizontally-instead ()
  (interactive)
  (save-excursion
    (delete-other-windows)
    (funcall (split-window-func-with-other-buffer 'split-window-horizontally))))

(defun split-window-vertically-instead ()
  (interactive)
  (save-excursion
    (delete-other-windows)
    (funcall (split-window-func-with-other-buffer 'split-window-vertically))))

(global-set-key "\C-x|" 'split-window-horizontally-instead)
(global-set-key "\C-x_" 'split-window-vertically-instead)


(provide 'init-window-split)

Add split-window-vertically-instead, bound to "C-x _"
Add split-window-vertically-instead, bound to "C-x _"

Jadecity/PurcellEmacs.d,Enzo-Liu/emacs.d,zuoshifan/emacs.d,carlosliu/emacs.d,ruiyang/emacs.d,qianwan/emacs.d,kongfy/emacs.d,mpwang/emacs.d,dongdonghu/.emacs.d,cyjia/emacs.d,zuoshifan/emacs.d,arthurl/emacs.d,lujianmei/emacs.d,wegatron/emacs.d,cjqw/emacs.d,zuoshifan/emacs.d,sgarciac/emacs.d,ruiyang/emacs.d,blueseason/emacs.d,lromang/emacs.d,zhuoyikang/emacs.d,hkcqr/emacs.d,zuoshifan/emacs.d,Togal/emacs.d,zuoshifan/emacs.d,wenpincui/emacs.d,krzysz00/emacs.d,farzadbekran/emacs.d,scorpionis/emacs.d,46do14/emacs.d,boblannon/emacs.d,LKI/emacs.d,gsmlg/emacs.d,farzadbekran/emacs.d,shafayetkhan/emacs.d,mmqmzk/emacs.d,zenith-john/emacs.d,qinshulei/emacs.d,farzadbekran/emacs.d,caoyuanqi/emacs.d,zuoshifan/emacs.d,modkzs/emcs.d,YangXin/emacs.d,LittleLmp/emacs.d,purcell/emacs.d,jthetzel/emacs.d,DarkThrone/emacs.d,fengxl/emacs.d,kindoblue/emacs.d,Shanicky/emacs.d,ernest-dzf/emacs.d,Guoozz/emacs.d,Werewolflsp/emacs.d,zuoshifan/emacs.d,zuoshifan/emacs.d,baohaojun/emacs.d,jachinpy/emacs.d,roxolan/emacs.d,braveoyster/emacs.d,bibaijin/emacs.d,jkaessens/emacs.d,zhaotai/.emacs.d,danfengcao/emacs.d,benkha/emacs.d,dcorking/emacs.d,renatoriccio/emacs.d,pairyo/emacs.d,ilove0518/emacs.d,whizzzkid/emacs.d,alant/emacs.d,jhpx/emacs.d,zuoshifan/emacs.d,emuio/emacs.d,lust4life/emacs.d,farzadbekran/emacs.d,jachinpy/emacs.d,farzadbekran/emacs.d,haodaivshen/emacs.d,me020523/emacs.d,blueabysm/emacs.d,dhanunjaya/emacs.d,hophacker/emacs.d,YangXin/emacs.d,svenyurgensson/emacs.d,exclamaforte/emacs.d,atreeyang/emacs.d