0

I'm currently logged into a server via ssh with ssh -Y and running a tmux session.

If I start vim and run :colorscheme elflord the color scheme is changed. (Although the colors are not exactly what I would expect although they are I think 256 color.

If I create a ~/.vimrc file and put a single line

colorscheme elflord

in it then when I run vim it shows no color (just white text) and I cannot change the color with the :colorscheme command.

9
  • 1
    OK, but I think "breaks" is too strong of a word to use in that circumstance. I mean, you still have all the basic functionalities of Vim, correct?
    – Quasímodo
    Jun 26, 2020 at 18:29
  • I can use it to edit files, but no syntax highlighting doesn't work for example. I'm not sure what else I should test. Jun 26, 2020 at 18:37
  • What happens if you issue :syntax on after opening Vim?
    – Quasímodo
    Jun 26, 2020 at 18:39
  • Are you sure you're running the same vim before and after this experiment? Are your results repeatable? Jun 26, 2020 at 19:15
  • What's $TERM set to on each system? Read man tput. Is the elflord colorscheme installed on the server?
    – waltinator
    Jun 26, 2020 at 19:17

3 Answers 3

4

In recent versions of Vim (starting with Vim 8, I believe), if the user has no personal ~/.vimrc file, then Vim will execute the defaults.vim from its runtime directory instead, to load sane defaults.

The usual recommendation is that when you first create your ~/.vimrc file, you should include a couple of lines at the top sourcing the defaults.vim file, in order to preserve the same settings you were getting from that file (which include enabling filetype detection and syntax highlighting.)

See :help defaults.vim, which will tell you to start a new ~/.vimrc file with the lines:

unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim

You can then add your colorscheme elflord configuration below these two lines. That should preserve the settings you get by default, but change the colorscheme you use at startup.

1

If you want to change color-scheme in vimrc you should also turn on syntax:

syntax on
colo elflord

Also check that the color-scheme is installed

0

I think this is what is happening

  • Creating the ~/.vimrc file stops vim from reading the system wide vimrc file in /etc/vim/vimrc. (Or whereever it is on your system from standard install.)

I don't know if this is a bug. But I think it is. I don't know where to report bugs for vim. I will investigate.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .