DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Run Shell Command in Emacs


Command in minibuffer

M-!: single shell command (only output of current command is save to buffer Shell command output);

C-u M-!: save output of command to current buffer;

M-|: run command on selected region (use visual mode in Evil or M-h of emacs to select region);

Shell Mode

M-x shell: only support line mode command;

You can move your cursor to previous line (you can edit it) and press Enter (Insert or Normal mode both OK in Evil), this command will be copy to last line and be executed.

Delete output of last command: C-c C-o;

Move between "Command Group"(a command and its output): C-c C-p/C-c C-n;

Term Mode

M-x term: is a full shell environment. tab-completion and vi is supported;

Note: Use M-p/M-n to get previous/next commands (like Up/Down arrow key in terminal);

Ref:

  • Chapter 5 in "Learning GNU Emacs";

  • 31.15. Running Shell Commands from Emacs



Published

Sep 26, 2013

Last Updated

Sep 26, 2013

Category

Tech

Tags

  • emacs 22
  • shell 46

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor