Skip to content

Command Line Shell with Spacemacsλ︎

A simple shell can be run with the shell function. This shell function opens a new buffer with a shell prompt and displays that buffer, replacing the currently highlighted buffer.

Space ' opens a popup shell buffer in the root of the user account. Consecutive presses toggle the shell popup buffer for quick access.

Space p ' opens a popup buffer in the root of the current project directory.

exit command at the shell prompt to close the shell.

Adding the shell layerλ︎

Add the shell layer to dotspacemacs-configuration-layers section of ~/.spacemacs. Or SPC SPC eshell will prompt to install the shell package if its not currently added.

The shell popup is configured in the dotspacemacs-configure-layers section of the ~/.spacemacs file.

(shell :variables
       shell-default-height 30
       shell-default-position 'bottom)

shell-default-position can be top, bottom, left or right.

shell-default-height defines the percentage of the Spacemacs frame to use.

Customising eshell promptλ︎

Practicalli created a custom Eshell prompt. The code can be found in the practicalli/spacemacs.d configuration, in the dotspacemacs/user-config section.

Spacemacs Eshell custom prompt

Configure shell to use multi-termλ︎

multi-term uses the default shell from the operating system.

Set the shell-default-shell variable to 'multi-term in the shell layer in the ~/.spacemacs file.

Here is an example with the multi-term shell set, along with popup size and location

     (shell :variables
            shell-default-shell 'multi-term
            shell-default-height 30
            shell-default-position 'bottom)

Space ' now opens a shell buffer as a popup with the default shell of your operating system terminal.

Configure multi-term to use zshλ︎

I have zsh configured for my terminal window which uses prezto to provide extra shell features.

Add the following to dotspacemacs/user-config in your ~/.spacemacs file

(setq multi-term-program "/usr/bin/zsh")

Space f e to save the ~/.spacemacs file.

Space f e R to reload the configuration, or SPC q r to restart Spacemacs.