I'm learning Vim for programming on my lubuntu laptop, but the dark blue color for comments makes my eyes melt. It looks better when using :set background=dark but it does not seem to remember this between sessions. I am a bit scared of changing the syncolor.vim file. Is there another way to make Vim remember this setting?

1 Answer 1


Short answer: add that line (without the colon) to your ~/.vimrc file

set background=dark

Yup, just edit the vi settings file with vi. Create it if it doesn't exist. You can also address syntax coloring individually. Add this to .vimrc:

hi Comment  term=none  ctermfg=magenta  guifg=Magenta

Vim also supports entire, ridiculously complex suites of syntax color schemes. This comes down to picking a scheme you like from, say vimninjas.com or vim.org, dropping the color scheme file (molokai.vim, say) into the ~/.vim/colors directory that you made just now, and adding this to .vimrc:

colorscheme molokai

Other programmer-friendly .vimrc settings I think you'll like:

set scrolloff=3
set incsearch
set hlsearch
hi IncSearch ctermfg=blue ctermbg=white

Those affect searching, and adjust the view when you move near the top or bottom edge. Add that last line BTW, only if you don't set a color scheme. Yet another thing: I usually find the answer to tricky Vim topics somewhere on vim.wikia.

You must log in to answer this question.

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