Skip to content

DarwinAwardWinner/amx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amx, an alternative interface for M-x in Emacs

MELPA Build Status

Amx is an alternative interface for M-x in Emacs. It provides several enhancements over the ordinary execute-extended-command, such as prioritizing your most-used commands in the completion list and showing keyboard shortcuts, and it supports several completion systems for selecting commands, such as ido and ivy.

Installation

You can install amx from from MELPA.

If you want to use the ido or ivy backends, you'll need to install the linked packages as well. If you already have these installed and enabled, Amx should use them automatically.

Since Amx is a fork of Smex, it retains compatibility with the format of smex-save-file. If you are migrating from smex to Amx, Amx will automatically load your smex saved history the first time it is used, so all your frequently-used commands will still be sorted at the top.

Usage

To replace regular M-x with Amx, use M-x amx-mode. This will remap execute-extended-command (the command normally run by M-x) to amx. You can verify that Amx is active by checking for keyboard shortcuts in the completion buffer. If you need to turn it off, use M-x amx-mode again. Customize this variable to permananely enable the mode.

Completion backends

Amx currently supports several different completion backends, including standard Emacs completion, Ido completion, Ivy completion, and others. By default, Amx tries to automatically detect which completion system you are using and match your settings. For example, it will use ido completion ido-mode is enabled. So you should generally get the same kind of completion that you're already used to. However, you can also force Amx to use a specific completion system by customizing the variable amx-backend.

Showing keyboard shortcuts for commands

When completing command names, Amx shows the keyboard shortcut for all commands currently bound to a key, so you can find out when there's an easier way to run the command you're looking for. Alternatively, if you know the keyboard shortcut but don't remember the name of the command it's bound to, you can complete based on the keyboard shortcut (this works best with ido or ivy backends). If you don't like this, you can disable it by customizing amx-show-key-bindings.

Getting help for commands

C-h f, while Amx is active, runs describe-function on the currently selected command.

M-. jumps to the definition of the selected command.

C-h w shows the key bindings for the selected command. (Via where-is.)

Show only major mode commands

amx-major-mode-commands runs Amx, limited to commands that are relevant to the active major mode. Note that this command is not bound to any key by default, so if you use it a lot, you should add your own key binding for it.

Show unbound commands

amx-show-unbound-commands shows frequently used commands that have no key bindings.

Persistence between sessions

Amx keeps a file to save its state betweens Emacs sessions. The default path is ~/.emacs.d/amx-items; you can change it by customizing the variable amx-save-file. Unlike Smex, it should be safe to change the save file after loading Amx.

If amx-save-file does not exist but smex-save-file is defined and does exist, Amx will load its state from that file instead. This facilitates migrating from Smex to Amx while retaining all of your saved command history.

Ignoring commands

Certain commands are not very useful to run via M-x. These include commands that only have an effect when bound to certain keys (e.g. self-insert-command), commands that are marked obsolete, and commands meant for mouse interaction. Amx will not present these commands in the list of completions, but just in case, it will still let you enter them if you know their name. You can tell Amx to ignore additional commands by customizing amx-ignored-command-matchers.

Speeding up Amx

There are two features that can cause a noticeable delay (around 1/4 of a second) when running amx: command ignoring and showing key bindings. Generally this delay is not a problem, since you can start typing imediately and Amx will catch up after the short delay. However, if it bothers you, these delays can be greatly reduced by setting one or both of amx-ignored-command-matchers and amx-show-key-bindings to nil.

Running the tests

Amx comes with a test suite. If you want to run it yourself, first install Eldev, then use eldev test to run the tests. Please run this test suite before submitting any pull requests, and note in the pull request whether any of the tests fail.

Relationship to Smex

Amx is a fork of Smex, which appears to no longer be under active development. However, Amx has diverged significantly from Smex and should be considered a separate package. New features include multiple completion backends, showing/completing on key bindings, and hiding irrelevant commands.

Since the last tagged release of Smex was version 3.0, the first release version of Amx is 3.1.

About

An alternative M-x interface for Emacs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 99.7%
  • Shell 0.3%