Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customise Oh My ZSH within a Spacemacs shell?

Context

I have a nice and beautiful setup on iTerm2 (I'm using a Mac) where the default shell is ZSH and it is properly customized using Oh-my-zsh and the Agnoster-fcamblor Theme.

enter image description here


Issue

As a Spacemacs user, I would like to do as much as possible without leaving Emacs. So I decided to invoke a terminal window from inside of it, as I'm used to doing with Vim/tmux.

This is the look that I get (in the same directory):

enter image description here


Things I've checked

Apparently the Theme is not being applied.

This is the relevant part of my ~/.spacemacs:

(shell :variables
        shell-default-shell 'ansi-term
        shell-default-height 30
        shell-default-term-shell "/bin/zsh"
        shell-default-position 'bottom)

A few important things:

  • $> echo $0 shows me ZSH is the shell being used inside Spacemacs.
  • $> echo $PS1 shows me it is properly set and it matches iTerm2.
  • I tried sourcing the configuration file I use but, as the above fact suggests, it is already being loaded.

Question

How can I apply the Oh-my-zsh Theme inside a Spacemacs Shell Window?

like image 862
Jonathan Soifer Avatar asked Aug 20 '17 09:08

Jonathan Soifer


People also ask

How do I change my oh my zsh theme?

You can browse all the “Oh My ZSH” Themes here. To change the Theme, simply change the ZSH_THEME value in ~/. zshrc file from robbyrussell to Avit.

What can you do with Ohmyzsh?

It is the most popular framework for managing Zsh configuration, plugins, and themes. It will help you transition from using your current shell to Zsh in the easiest way possible. Although Oh My Zsh can do many other things, it is the most famous for its ability to easily manage a ton of themes and plugins.

How do I open a zsh file on a Mac?

Go to the “Shell” tab and check “Run command:” and enter “zsh”

What is zsh Mac?

The Z shell (also known as zsh ) is a Unix shell that is built on top of bash (the default shell for macOS) with additional features. It's recommended to use zsh over bash . It's also highly recommended to install a framework with zsh as it makes dealing with configuration, plugins and themes a lot nicer.


1 Answers

Instead of trying to make Spacemacs options override the terminal options (wasn't able to do it), I decided to match the Spacemacs Theme with the Agnoster-Fcamblor theme I've been using, this way both have the same colors and backgrounds (a.k.a. skin/theme).

1. Inside dotspacemacs-additional-packages:

color-theme-solarized

2. Inside dotspacemacs/user-config:

(defun dotspacemacs/user-config ()

;; Fix separators
(setq ns-use-srgb-colorspace nil)
;; (setq powerline-default-separator 'utf-8)
;; Theme Customizations
(setq theming-modifications
    '((solarized
       ;; Provide a sort of "on-off" modeline whereby the current buffer has a nice
       ;; bright blue background, and all the others are in cream.
       ;; TODO: Change to use variables here. However, got error:
       ;; (Spacemacs) Error in dotspacemacs/user-config: Wrong type argument: stringp, pd-blue
       (mode-line :foreground "#e9e2cb" :background "#2075c7" :inverse-video nil)
       (powerline-active1 :foreground "#e9e2cb" :background "#2075c7" :inverse-video nil)
       (powerline-active2 :foreground "#e9e2cb" :background "#2075c7" :inverse-video nil)
       (mode-line-inactive :foreground "#2075c7" :background "#e9e2cb" :inverse-video nil)
       (powerline-inactive1 :foreground "#2075c7" :background "#e9e2cb" :inverse-video nil)
       (powerline-inactive2 :foreground "#2075c7" :background "#e9e2cb" :inverse-video nil)
       ;; Make a really prominent helm selection line.
       (helm-selection :foreground "white" :background "#2075c7" :inverse-video nil)
       ;; See comment above about dotspacemacs-colorize-cursor-according-to-state.
       (cursor :background "#b58900")
     )))
like image 123
Jonathan Soifer Avatar answered Oct 01 '22 00:10

Jonathan Soifer