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.
.Xresources
*customization: -color XTerm*termName: xterm-256color
.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.
Put a colorscheme directive in your ~/.vimrc file
For example
Update1:
With your ~/.vimrc and installation of Vundle I reproduced your problem. Add
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
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