Emacs Window Commands
I recently bought a new large monitor, which opened the possibility of using Emacs with multiple, side-by-side windows. Which is brilliant by the way! Since I plugged it in, I’ve been C-x 3
-ing like a madman. My new favorite way to learn programming is having an info file open in the left window and in the right window having a scheme (or python) prompt open. That is what I am doing now working on the Structure and Interpretation of Computer Programs. Luckily there was an info file available. I’m trying to think of a simple way to translate my programming epubs or pdfs into info files.
Anyways on to todays topic. Emacs window commands!
The first thing to keep in mind, is the difference between windows and frames in emacs. To emacs: a window is any portal to a buffer. if you type in C-x 2
in emacs and your view splits in half. These two portals are known as windows. What we usually call a new window, is known as a frame to emacs. So when you type in Ctrl-n in your browser and a new window pops open, in Emacsia, this is known as a new frame.
Open another window:
C-x 2 open another vertical window.
C-x 3 open another horizontal window.
C-x 4 b open a buffer in the other window
C-x 4 f open a new file in the other window.
C-x 1 close all other windows, leave current window open.
C-x 0 close current window, switch to other window.
C-x o move to other window
Positioning windows:
C-x + balance windows. This balances the size of all open windows.
C-x { widen current window.
C-x } narrow current window.
C-u C-x { widen current window by 4 columns.
C-u C-x } narrow current window by 4 columns.
Scroll other window:
M-C-v scroll other window