Replace Your Terminal with Emacs

by Peter Stuart on July 24, 2021

When I’m working in Emacs, I use vterm as a terminal emulator. Rather than use a separate terminal emulator when I’m not already in Emacs, I’d like to be able to easily open a new Emacs frame with a fresh terminal in it. To do that, I wrote a script which runs emacsclientThis requires that you are running Emacs as a daemon.

, opens a new frame, and launches vterm:

emacsclient -cn --eval "(progn (x-focus-frame nil) (vterm t))"

On Linux, with XMonad as my window manager, I bind this script to S-s-<return>. On macOS, I use Alfred to bind it to ⇧⌘⏎.Alfred runs the script from the path of the workflow that contains it, so I add cd ~ to the beginning of the script on macOS.