nashamri / spacemacs-theme

Light and dark theme for spacemacs that supports GUI and terminal
GNU General Public License v3.0
596 stars 113 forks source link

cursor colors! a little help. #193

Closed mczuba closed 2 years ago

mczuba commented 2 years ago

Hi there guys,

I'm so happy that I found this -- it makes me feel almost at home while using Doom. The only things that I /really/ miss are the cursor colors.

I'm a little confused -- a lot of others, in their screenshots, seem to be getting the beloved Spacemacs orange/lime green (for N/I modes, respectively) colors for their cursor. In fact, even the second two screenshots in the README are using this orange normal mode cursor that I want. I presume that insert mode with that configuration would give the desired lime green insert cursor. However, by default, I have a plain-old white/light-grey cursor regardless of mode.

Are these easy to move to without having to guess around with a custom color? Seems like it should be obvious, but I haven't found an easy way to get there.

Thanks for reading the n00by question. :)

-- mncz

nashamri commented 2 years ago

Hello there, @mczuba

I believe you can set the cursor color depending on which state its in by setting these evil variables:

evil-normal-state-cursor
evil-insert-state-cursor
evil-visual-state-cursor
evil-operator-state-cursor
evil-replace-state-cursor
evil-emacs-state-cursor
evil-motion-state-cursor

And the color names in Spacemacs are defined here: https://github.com/syl20bnr/spacemacs/blob/532ad2567cba1d57d09e102c385315e7cfa829ec/layers/%2Bdistributions/spacemacs-bootstrap/config.el#L83

So, you can do something like this in your config:

  (setq evil-emacs-state-cursor '(bar "SkyBlue2"))
  (setq evil-normal-state-cursor "DarkGoldenrod2")
  (setq evil-visual-state-cursor "gray")

etc..

mczuba commented 2 years ago

Thanks for your help! I don't know what half of those cursors defined in spacemacs are, but it's nice to know that I can look back to this and reference them as I get there.

I got what I wanted (i.e. what I was asking for above) by adding the following to my config.el:

(setq evil-normal-state-cursor '(box "DarkGoldenrod2")) (setq evil-insert-state-cursor '(bar "chartreuse3"))

I'm not quite sure what an hbar is, and what the (bar . 2) syntax is doing, but that's a problem for later customization. :sunglasses:

edit: Unless somebody wants to chime in with disambiguation about the last comment (regarding hbar and (bar .2 )), then this can be closed. =)

nashamri commented 2 years ago

Hey there,

(bar . 2) sets the cursor to be a 2 pixel-wide bar, to control the shape of the cursor. You can do something like this:

  (setq evil-normal-state-cursor '((bar . 2) "DarkGoldenrod2"))

or whatever you like :smile: To see all the types you can check the variable cursor-type (C-h v and write "cursor-type").

The code that I mentioned previously in spacemace was just to show you the name of the colors used by spacemacs. Doom and spacemacs both use evil to emulate vi. I got the name of the "states" from here https://github.com/emacs-evil/evil/blob/master/evil-states.el. If you check this file, you'll see some declarations (like this one) that define the default states in evil.