Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs equivalent of Vim's command history (for typed in Meta-x commands)

Question: For typed in commands invoked via M-x I am having difficulty understanding how Emacs allows recalling and rerunning the commands. The command-history works quite differently from Vim. It puts the commands in a buffer rather than the "minibuffer".

Is there a way to get something similar to Vim's approach (i.e., previously typed commands can be scrolled through simply using the arrow up-down keys)?

like image 568
dreftymac Avatar asked Dec 21 '08 00:12

dreftymac


People also ask

What is Emacs and vim used for?

Emacs and Vim User Interface Vim uses editing modes - most commonly the command mode and insert mode. Vim aims to minimize the number of keystrokes that a user has to press, because vi, upon which Vim is based, was designed to be used over slow terminals.

What is Emacs in Linux?

Emacs is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has over 1,000 editing commands. It also allows the user to combine these commands into macros to automate work.

What are the different modes of editing in Vim?

Vim uses editing modes - most commonly the command mode and insert mode. Vim aims to minimize the number of keystrokes that a user has to press, because vi, upon which Vim is based, was designed to be used over slow terminals.

Why is it called Vim?

The name "Vim" is an acronym for "Vi IMproved" because Vim was created as an extended version of the vi editor, with many additional features designed to be helpful Vim uses editing modes - most commonly the command mode and insert mode.


2 Answers

C-x ESC ESC, C-x M-ESC, or C-x M-: puts your history in the minibuffer, after which you can scroll back and forth as you like with the arrow keys.

M-x list-command-history puts the whole history in a buffer from which you can execute commands.

C-x z repeats the last command.

Look at EMACS manual (info) section 8.5 Minibuffer History.

like image 85
Charlie Martin Avatar answered Nov 15 '22 08:11

Charlie Martin


M-p and M-n are the canonical history navigation keys in GNU software. Emacs is no exception; this works nearly everywhere where you can type something.

In the case of extended commands ("M-x commands"), hit M-x, then navigate freely throughout the history. You can also do a reverse history isearch with C-r, as in bash.

like image 44
jrockway Avatar answered Nov 15 '22 08:11

jrockway