: Learning GNU Emacs, 3rd Edition

4.3.2 Moving Between Windows

4.3.2 Moving Between Windows

To move from one window to another, type C-x o(o stands for other in this command). If you have more than two windows displayed, Emacs moves from one to the next. There's no way to specify which window to move to, so you may have to type C-x o a few times to get to the one you want if you have more than two windows displayed. (You can also click your mouse in a window if you're using the GUI version.)

Now that you can create windows and can move between them, what else can you do? Practically anything. With our two windows on dickens open, one on top of the other. Initially, both of these windows are looking at the same file.

Type: C-x 2


Two windows open on dickens.

We can give any editing commands we want within either window. We can move back and forth in one window without affecting the other. Let's see what happens if we want to edit another file.

Type: C-x C-f blake


Now you have two windows, two buffers, and two files.

By using C-x o, we can edit one file and then the other. We can kill text from one buffer and yank it back in another. For example, let's move the first line of Blake's poem to the top of the dickens buffer.

Type: C-k C-k C-x o M-< C-y Enter


The Blake text has been yanked into the dickens buffer.

Editing with multiple buffers in separate windows is particularly useful if, for example, you want to copy material from one file to another or if you want to read a file containing reference material while editing another. Programmers often need to look at several different files at the same timefor example, a header file and a code file, or a function call site and the routine that's being called. Once you get used to the commands for moving between different windows, you may spend most of your time with two or three windows on your screen.


: 0.437. /Cache: 3 / 1