I prefer emacs keystrokes, but select-all doesn't seem to be part of the emacs vocabulary, or at least, the gtk-key-theme for emacs. M-w isn't working to copy the selected region.

  1. What's the keystroke for select-all?
  2. Where is a key binding map for this theme?

Thanks, Steve

6 Answers 6


There is a simple binding for "Select all" in gtk: C-/

It’s defined as a general GtkTextView signal and not specifically part of the emacs key theme. But it works fine with it. It's defined as an alternative to C-a. While the latter gets reinterpreted by the emacs theme C-/ remains valid for "Select all".

  • Great answer. Why didn't it have any upvotes yet?
    – Rörd
    Nov 5, 2015 at 2:19

There isn't a single shortcut to do so directly.

You can go to the end of the text with Ctrl-e and remove a line Ctrl-u. This, however only works with GtkEntry, that is, one-line input field.

If you need to select everything in a GtkTextView, the multi-line editor-like control, you are left to do the onerous Ctrl-Home followed by Ctrl+Shift-End, which, with my 63-key keyboard is almost impossible.

If, for the good reason of editing efficiency or limitations of mobile device's keyboards, Home and End are out of reach, then you will have to get by. Selecting "Select-all" from "Edit" menu is a bad idea, because it maps to Alt-e - a in firefox, Alt-e - t in gedit, Alt-e - s in OpenOffice (even with gnome-integration), in each software a different key, and in some software, there is no "Select-all" in Edit Menu, like chromium, and in some software, there is not even Edit Menu itself, not even a hidden one to be called out with Alt-e, like nautilus. This inconsistence beats the purpose of the Alt-activated menu bar, and not any operating system, not even Windows, is as inconsitant. Even the right-click menu doesn't have a fixed shortcut for "Select-All" - it is usually a but can be t from application to application. Calling for bug-fix in each individual software can only be done with a meta-project like GNOME, but knowing GNOME itself produced some of these problems (removal of Edit Menu in 'nautilus' is a GNOME 3 decision) really didn't leave you much hope.

On a side note, Ctrl-Home is the only short-cut to move to the beginning of all text, even it may interrupt your work to key in for small-keyboard mobile devices.

The answer finishes here. For the curious minds I have additional information:

A seasoned emacs user would attempt Ctrl-x-h: authentic emacs indeed, but no control key-sequence are understood by gtk3's emacs mode. In fact, only a handful of emacs shortcuts are defined - Take a peeked at /usr/share/themes/Emacs/gtk-3.0/gtk-keys.css; there are enough space on a sticker to write down all supported emacs shortcuts.

To make the situation even worse, it is difficult to relocate a shortcut key for this purpose. As you know, Ctrl-a is taken by emacs. But even Hispanophones, the largest non-English speaking group (Chinese excluded because we use ideographs), who are used to select everything with Ctrl-e, would find that keyboard shortcut taken by emacs, too. Excluding e, there are not any other key left in the left half of a QWERTY keyboard without an already-well-accepted purpose. Google Translate takes SHIFT key, when pressed alone, as 'select-all', but non other software nor other Google products follow the setting.

To empty a line, use Ctrl-u. This has the advantage of not overwriting X SELECTION (the one you yank with middle mouse button). This is a unique setting only of gtk3's emacs mode: in real emacs it doesn't do anything on its own; in readline (bash, mysql etc) it is supposed to delete everything from cursor to begining of the line, while its counter-part Ctrl-k deletes everything from cursor to the end of the line.

Some may suggest you leave a mark somewhere for random selection with keyboard. You may also find Ctrl-SPACE is in emacs mode configured to set an anchor in the text. Despite conflicting with many other software (ideograph input methods in particular, and auto-completion in some other editor software), there is not any shortcut key to make use of the anchor you set.

Ubuntu does not officially suppoprt emacs editing mode, nor anything other UI configuration that cannot be done with UI. Bug reports about such needs are marked down-priority. For this reason I think it is best to ask such question to Linux-generic places, e.g. superuser.


The emacs bindings are specified at /usr/share/themes/Emacs/gtk-2.0-key/gtkrc You can also add a bindings in ~/.config/gtk-3.0/gtk.css

Select all would be something like this:

bind "<ctrl>h" { "move-cursor" (buffer-ends, -1, 0)
                 "move-cursor" (buffer-ends,  1, 1) };

I haven't found a way to bind it to C-x h, though.


View existing key binding

For GTK3 applications, you can view the bindings of the Emacs GTK key theme - either locally, probably at /usr/share/themes/Emacs/gtk-3.0/gtk-keys.css) - or on the GTK git repository on GitHub (which doesn't necessarily equal your local file, as your distro might have modified it).

While reading this file, you have to be aware of the meaning of the widgets

(Look at the image at the top of each linked site.)

Adding key binding for selecting all

select-all for GtkTreeView and GtkTextView

For GtkTreeView and GtkTextView widgets, there is a signal called select-all. You need to pass it the argument 1 so that it selects all rather than deselecting.

So, edit ~/.config/gtk-3.0/gtk.css and add something like this:

@binding-set my-text-and-tree-view-bindings
    bind "<alt>a"
    "select-all" (1)

textview {
  -gtk-key-bindings: my-text-and-tree-view-bindings;

treeview {
  -gtk-key-bindings: my-text-and-tree-view-bindings;


For GtkEntry there is no select-all signal. Instead you can use a sequence of two move-cursor signals marking the text.

Again, edit ~/.config/gtk-3.0/gtk.css and add something like this:

@binding-set my-entry-bindings
    bind "<alt>a"
    "move-cursor" (paragraph-ends, -1, 0)
    "move-cursor" (paragraph-ends,  1, 1)

entry {
  -gtk-key-bindings: my-entry-bindings;


By the way, in Firefox Alt-a selects all for me by default without configuration (using the Emacs GTK key theme).


If you want to select all text in a region, I prefer defining a simple Macro for that. Press F3 for starting to write a Macro. Then type

Esc - <          // goes to beginning of document
Ctrl - spacebar  // set mark
Esc - >          // selects all till end of document

Then use M -w for copying (which is what I normally do for copying from remote unix systems to local Windows) and then press F4 to finish defining the macro.

Now you are done defining the Macro, just hit F4 as many times you want to repeat the action.

  • The GTK Emacs key theme is not the same as Emacs itself. Almost none of the key bindings in your answer work there (and if you actually were in Emacs itself, you could just use C-x h instead of a macro.
    – Rörd
    Nov 5, 2015 at 2:15

http://www.emacswiki.org/emacs/EmacsNewbieKeyReference#toc8 appears to be what you're looking for ( C-x h after setting marker )

Also, depends on whether you want the 'page', or buffer, etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .