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 have a problem wherein, whenever I start VIM the colorscheme I set on my .vimrc it doesn't take effect upon first running VIM, but then whenever I execute :colorscheme 'mycolorscheme' the colorscheme is applied.

I'm a beginner in linux, so please bear with me.

I'm just thinking if there is a setting that should be set. Here are the settings I set using xterm.

  1. .Xresources

    *customization: -color
    XTerm*termName: xterm-256color
    
  2. .xsession

    if [ -f $HOME/.Xresources ]; then
         xrdb -merge $HOME/.Xresources
    fi
    

Upon running xrdb -query Here's the output:

*customization:-color
XTerm*termName: xterm-256color
Xft.dpi:    96
Xft.antialias:  1
Xft.hinting:    1
Xft.hintstyle:  hintslight
Xft.rgba:   rgb
Xft.lcdfilter:  lcddefault

Btw, only the colorscheme don't take effect whenever i want to start VIM. But all mapping and other settings work

Here's my .vimrc

    "**********************************************"
"           VUNDLE SETTINGS                    "
"**********************************************"

set nocompatible " be iMproved 
filetype off    " required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
filetype plugin indent on " required!

"**********************************************"
"           PLUGINS                            "
"**********************************************"
"EasyMotion
Bundle 'Lokaltog/vim-easymotion'
"Sparkup
Bundle 'tristen/vim-sparkup'
"Surround
Bundle 'tpope/vim-surround'
"CsApprox
Bundle 'godlygeek/csapprox'

"**********************************************"
"           COLOR SCHEMES                      "
"**********************************************"

"   Distinguised
Bundle 'Lokaltog/vim-distinguished'
"   Github  
Bundle 'endel/vim-github-colorscheme'
"   VividChalk  
Bundle 'tpope/vim-vividchalk'
"   Pyte    
Bundle 'therubymug/vim-pyte'
"   Vibrantink
Bundle 'vim-scripts/vibrantink'

"**********************************************"
"           MAP LEADER                         "
"**********************************************"
let mapleader = ","

"**********************************************"
"           SYNTAX                             "
"**********************************************"
syntax enable

"**********************************************"
"           VIM SCRIPTS                        "
"**********************************************"
if has('gui_running') 
    colorscheme github
else 
    colorscheme pyte
endif

"**********************************************"
"           CUSTOM SETTINGS                    "
"                                              "
"**********************************************"
set hidden

" Show what mode you're currently at
set showmode

" Enable enhanced command line completion
set wildmenu

" Don't redraw while executing macros
set lazyredraw

" Indentation settings (SOFT TABS)"
set shiftwidth=4
set softtabstop=4
set smarttab
set expandtab "enable this to use spaces instead of tabs

" show line number
set nu

" hightlight as you type
set incsearch
" ignore case when searching
set ignorecase

" set statusline
set laststatus=2

"**********************************************"
"       NOTE don't map <c-s> and <c-q>         "
"**********************************************"

"**********************************************"
"           KEYMAPS                            "
"**********************************************"

"*******NORMAL MODE MAPPING********"
"map for editing .vimrc
nnoremap <leader>ev :e $MYVIMRC<cr>
"map for sourcing vimrc
nnoremap <leader>sv :so $MYVIMRC<cr>
"map for switching windows
"_ in this keymap is to jump for a line with a nonblank char
nnoremap <space> <c-w><c-w>_

"*******INSERT MODE Mapping********"
"map for escape while in insert mode
inoremap <leader>; <esc>
"map for ins-completion
inoremap <leader>x <c-x>

"*********COMMAND MODE Mappings*******
"exit out of command line mode
cnoremap <leader>; <c-c>

Edit

It doesn't work whatever terminal emulator i used. Either gnome-terminal or xterm. It seems like the colorsheme is indeed loaded. Upon first loading, Typing :colorscheme reports the correct colorscheme which i set on my .vimrc. But it doesn't take effect the first time. I have to either type on VIM

:colo 'colorschemename'

or source it again to activate the colorscheme using

:so $MYVIMRC

But after exiting VIM, the colorscheme again doesn't take effect but it is loaded upon starting VIM.

Thanks in advance.

share|improve this question
    
it works on gvim but not on terminal :( –  chanHXC Aug 11 '13 at 16:48

2 Answers 2

Put a colorscheme directive in your ~/.vimrc file

For example

colorscheme evening

Update1:

With your ~/.vimrc and installation of Vundle I reproduced your problem. Add

set t_Co=256
colorscheme evening 

at the end of your ~/.vimrc and see if this works for you.

You can see also http://vim.wikia.com/wiki/Using_GUI_color_settings_in_a_terminal

share|improve this answer
    
yes i have one set. Thanks anyway –  chanHXC Aug 11 '13 at 13:08
    
Can I see your ~/.vimrc ? –  tuxar Aug 11 '13 at 13:23
    
i've edited the question. I've added my .vimrc –  chanHXC Aug 11 '13 at 13:45
    
Maybe you can backup your ~/.vimrc and then put only the colorscheme evening just to ensure that the problem relates to the ~/.vimrc file. –  tuxar Aug 11 '13 at 14:33
    
yes, something's wrong with my .vimrc i've only use colorscheme evening and it works –  chanHXC Aug 11 '13 at 15:04

I found the solution. I think i have to answer my own question. I'm really on despair so i went on to removing the plugins one by one through BundleClean! in Vundle to check if there's any plugin misbehaving.

It was not a problem with my .vimrc after all. It was a conflict with EasyMotion and CSApprox plugins.

I had my EasyMotion configuration before CSApprox on Vundle I followed the instructions on this one.

https://github.com/Lokaltog/vim-easymotion/issues/55

Here's another one that might help others with the same issues as mine.

https://github.com/Lokaltog/vim-easymotion/issues/39

share|improve this answer
    
If this answered your question, you may mark this answer as accepted, by clicking the green check mark next to it. That will indicate that your problem is solved. –  Radu Rădeanu Aug 28 '13 at 14:09

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.