3

I'm entirely new with Emacs. I'm trying to split vertically my window, but I can't.

Googling, I've discovered the commands to do it is C-Mouse-2. So I clicked Ctrl+scroll button+2 but it matched C-down-mouse-2.

So how can I deploy C-Mouse-2?

4

Where did C-Mouse-2 come from?

I assume you're talking about this page about splitting windows from the Emacs documentation, which has three commands:

C-x 2

Split the selected window into two windows,
one above the other (split-window-below). 

C-x 3

Split the selected window into two windows,
positioned side by side (split-window-right). 

C-Mouse-2

In the mode line of a window, split that window.

The third one is the one you're talking about, and is the one least frequently used. Most people use Emacs almost entirely by the keyboard, and consider the keyboard faster than the mouse for most tasks. But that's outside the scope of this question.

Why didn't it work when you tried it?

Note the description of C-Mouse-2: "In the mode line of a window, split that window." (Emphasis added)

The mode line is the part of the window near the bottom that looks like this:

U:---  *scratch*    All L5     (Lisp Interaction)

It changes based on the buffer you're in, the modes you have active, and more!

So the command to split the window isn't C-Mouse-2 just anywhere on the screen; you have to click with the mouse pointer over the mode line.

Running C-Mouse-2 to split the window

To run this command, press and hold Control, move the mouse over to the mode line of the window you want to split, press and release Mouse-2 -- that is, the middle mouse button -- then release Control. Emacs will split the window at the point you clicked.

The effect is the same as the second function the page points out -- split-window-right, which is bound to C-x 3 by default. When you use the mouse, you get to control the position of the split; using the keyboard splits the window evenly.

1

C-mouse-2 is not what you want. What you want is C-x 2. That means first press and hold Control while hitting x, and then hit 2 (that's the keyboard key labeled 2, not the second mouse button).

This assumes that your init file has not changed any of the default key bindings.

If it has, then you will need to let us know what C-h k mouse-2 tells you. That is: Hold Control while hitting h, then hit k, then click mouse-2 (that's the middle mouse button).

You need to read a little of the Emacs manual, to find out about how Emacs denotes keys and mouse actions. To consult the manual, use C-h r.

Start at the beginning of the manual, for an intro. The fourth "node" (page) of the manual is named User Input, and it gives you an intro to keys and characters, and how Emacs talks about them.

You can also read the manual in a web browser, here.

But it is much better to read the manual in Emacs itself. You can read about how to do that by consulting the Info manual from Emacs. To do that, use C-h i and choose the first link, named Info.

  • Your post helped me understand a little more the emacs. – Hellon Canella Machado Apr 21 '15 at 2:00
  • Welcome to Emacs! Have fun. Ask Emacs about Emacs: C-h C-h. – Drew Apr 21 '15 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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