3

I'm just starting with VIM and I'm trying to install this custom color scheme: https://github.com/devnul1/heman

I created a .vim directory on my home directory and inside .vim I created a directory colors, inside that I uploaded the color scheme file:

.vim/colors/heman.vim

I then created a .vimrc file with this configuration:

syntax on
colorscheme heman
set number

I know the .vimrc file is working because when I open VIM I get line numbers, but thing is I don't get the custom color scheme.

Am I doing something wrong? Could someone point me in the right direction?

Thanks in advance.

2
  • Do you get any error messages? What is the output of :colorscheme after starting up?
    – D. Ben Knoble
    Commented Feb 15, 2018 at 16:10
  • @DavidBenKnoble OK this is weird, color scheme wasn’t working on my Mac at home but now that I openned VIM in my iPhone the custom color scheme is working. Could this be related to the SSH client? Shoulded I restart the server after placing the color scheme file or something? Commented Feb 15, 2018 at 16:23

1 Answer 1

3

I notice that that colorscheme requires a 256 color terminal, based on this towards the beginning:

if !has('gui_running') && &t_Co != 256
    finish
endif

It's likely that your Mac at home doesn't set the TERM environment variable by default to indicate that it supports 256 colors, whereas your phone's terminal emulator/SSH client does.

Check the value of the TERM variable (echo $TERM); I'm guessing that it's xterm, indicating that the terminal does not support 256 colors, whereas it should be xterm-256color to indicate that it does.

Many terminal emulators (e.g. XTerm) still set the TERM to xterm by default for historical reasons even though they support 256 colors, requiring you to manually override that (to do this in XTerm, you set the following resource: XTerm*termName: xterm-256color). I'd imagine you just need to do that for whatever particular terminal emulator you're using on your Mac.

You could also try setting the TERM variable manually in your shell before entering VIM, e.g.:

TERM=xterm-256color vim

or

export TERM=xterm-256color
vim
3
  • 2
    For Terminal.app and iTerm (the only two widely-used term emulators I know of for Mac) this can be done directly in preferences.
    – D. Ben Knoble
    Commented Feb 15, 2018 at 16:39
  • 1
    Thanks @villapx It was the TERM setting indeed. I was using Termius both on Mac and on iPhone and oddly they do support xterm-256color on iPhone but not on Mac. Commented Feb 15, 2018 at 17:38
  • Thanks @DavidBenKnoble I switched to Terminal.app and found it is configured with xterm-256color by default. Commented Feb 15, 2018 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.