Contents

Running Oh-My-Zsh inside Spacemacs

Contents

When I start using Spacemacs, I was hoping there is a way to using my own configured zsh inside the Spacemacs workflow, after a look through the documentation, of course we can do it

First, we need to let Spacemacs load zsh when it setup shell, and I found you can do a pop-up buffer style with 30% of the current height from the bottom.

So in .spacemacs we can set this in dotspacemacs-configure-layers:

(shell :variables
       shell-default-term-shell "/bin/zsh" ;; find your zsh path using `$ whereis zsh`
       shell-default-height 30
       shell-default-position 'bottom)

This change is the basic setup, but since I enabled vi key bindings in my zsh, it starts conflicts with Spacemacs evil-mode. after a play around with different settings, I found the best option for me is to disable the evil-mode inside ansi-term.

Add following code in dotspacemacs/user-config:

(evil-set-initial-state 'term-mode 'emacs)

This change allows us navigation in ansi-term, but we can not editing anything in the input line. We need to do one more change:

(evil-set-initial-state 'term-mode 'emacs) ;; turn off evil-mode for ansi-term
(setq term-char-mode-point-at-process-mark nil) ;; allow editing in normal mode

After SPC f e R, we can now using zsh inside Spacemacs

Reference