I often split my windows into two with C-x 2. The window in the bottom tends to be the SLIME's REPL or Magit and the one at the top is usually the common lisp file being edited.

I like to have more space for the file to be edited. Thus, every time, I keep doing:

(i) - C-x 2; (ii) - Put the cursor on the window at the top (it is the default position); (iii) - C-x ^ enlarges the window. In order to do it multiple times, I use C-u 7 to repeat it 7 times. Thus, I press C-u 7 C-x ^

Is there a way to automate this? Maybe adding a hook to my config files so that every time I press C-X 2 then C-u 7 C-x ^ happens?

  • 1
    I believe this is a duplicate of stackoverflow.com/questions/10240192/… (but we can't close questions as duplicates across sites).
    – phils
    Aug 13, 2021 at 0:44
  • 2
    A simple shortcut would be to create a keyboard macro that records the keys you're using now, then just use that keyboard macro. You can bind that to a key (even C-x 2).
    – Drew
    Aug 13, 2021 at 4:22
  • 1
    you might want to have a look at the golden-ratio package which provides some more control over how windows are split.
    – zzkt
    Aug 13, 2021 at 9:20

1 Answer 1


This old answer in stackoverflow pointed out by @phils really helped me.

The following code in my init file did the trick:

(defun my-split-window-below (&optional arg)
  "Split the current window 70/30 rather than 50/50.
A single-digit prefix argument gives the top window arg*10%."
  (interactive "P")
  (let ((proportion (* (or arg 7) 0.1)))
    (split-window-below (round (* proportion (window-height))))))

(global-set-key (kbd "C-x 2") 'my-split-window-below)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.