Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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 or, 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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