Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

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.