Я настроил свой Vim для использования цветовой схемы Solarized, но каждый раз, когда я открываю Vim, он показывает неправильные цвета. Кроме того, в моем файле .vimrc
есть строка, которая говорит VIM перезагружать .vimrc
каждый раз, когда он сохраняется. Когда я открываю .vimrc
и ввожу в него только одно :w
, цвет автоматически исправляется.
Это строка в .vimrc
которая включает эту автозагрузку:
au BufWritePost .vimrc so ~/.vimrc
Мой Vim - это версия 7.4, скомпилированная мной, работающая на Ubuntu 14.04, внутри консоли, которая также была изменена на Solarized.
Для справки, это мой полный файл vimrc
:
set nocompatible " be iMproved, required
filetype off " required
set shell=/bin/bash
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" alternatively, pass a path where Vundle should install bundles
"let path = '~/some/path/here'
"call vundle#rc(path)
" let Vundle manage Vundle, required
Bundle 'gmarik/vundle'
" The following are examples of different formats supported.
" Keep bundle commands between here and filetype plugin indent on.
" scripts on GitHub repos
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
"Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
" scripts from http://vim-scripts.org/vim/scripts.html
"Bundle 'FuzzyFinder'
" scripts not on GitHub
"Bundle 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
"Bundle 'file:///home/gmarik/path/to/plugin'
" ...
"
Bundle 'L9'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/nerdtree'
"Bundle 'vim-scripts/Conque-Shell'
Bundle 'bling/vim-airline'
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'tpope/vim-surround'
Bundle 'ervandew/supertab'
Bundle 'kien/ctrlp.vim'
Bundle 'Raimondi/delimitMate'
"Bundle 'lepture/vim-css'
"Bundle 'groenewege/vim-less'
Bundle 'hail2u/vim-css3-syntax'
Bundle 'groenewege/vim-less'
Bundle 'Valloric/YouCompleteMe'
Bundle 'scrooloose/syntastic'
Bundle 'xolox/vim-session'
Bundle 'xolox/vim-misc'
Bundle 'altercation/vim-colors-solarized'
Bundle 'jelera/vim-javascript-syntax'
"Bundle 'pangloss/vim-javascript'
Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'marijnh/tern_for_vim'
Bundle 'vim-scripts/JavaScript-Indent'
Bundle 'othree/javascript-libraries-syntax.vim'
filetype plugin indent on " required
" ycm
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_confirm_extra_conf = 0
" solarized theme
syntax enable
set background=dark
let g:solarized_termcolors=16
color solarized
" session manager
:let g:session_autosave = 'no'
" fix end & home buttons
set term=xterm-256color
" airline
set laststatus=2
let g:airline_powerline_fonts = 1
" list files for open
set wildmenu
" reselect visual block after indent
vnoremap < <gv
vnoremap > >gv
" easy split nav
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Y behav
map Y y$
"move on wrapeed lines
nnoremap j gj
nnoremap k gk
" clear search highlights
"noremap <silent><Leader>/ :nohls<CR>
" automatically reload vimrc when it's saved
au BufWritePost .vimrc so ~/.vimrc
" leader remap
let mapleader = ","
" jk as esc
inoremap jk <Esc>
inoremap kj <Esc>
" absolute line numbers in insert mode, relative otherwise for easy
" movement
"au InsertEnter * :set nu
"au InsertLeave * :set rnu
" show current file in nerd tree
map <silent> <C-s> :NERDTree<CR><C-w>p:NERDTreeFind<CR>
" show line numbers
set number
" search case insensitive
set ignorecase
set smartcase
" searhc incremental
set incsearch
" ctrl-p
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlPMRUFiles' " by default ctrlp opens in mru + files mode
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " ignore shitty files
" ctrlp on enter, open in a tab. on c-e, open in current.
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-e>', '<2-LeftMouse>'],
\ 'AcceptSelection("t")': ['<cr>'],
\ 'PrtCurEnd()': ['<c-q>'],
\ }
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
"let g:ctrlp_custom_ignore = {
"\ 'dir': '\v[\/]\.(git|hg|svn)$',
"\ 'file': '\v\.(exe|so|dll)$',
"\ 'link': 'some_bad_symbolic_links',
"\ }
" nerd tree auto open on start
autocmd vimenter * if !argc() | NERDTree | endif
" nerd tree toggle with c-n
map <C-n> :NERDTreeToggle<CR>
" nerd tree auto close when opening a file
let NERDTreeQuitOnOpen = 1
" map Q to repeat last macro
nnoremap Q @@
" fold on syntax
set foldmethod=indent
set foldcolumn=0
set foldlevel=1
" set mouse
set mouse=a
" tab = 4 spaces
set tabstop=4
set expandtab
set shiftwidth=4
" css complete fix
"fu! InsertTabWrapper(direction)
"let char_before = col('.') - 1
"if !char_before || getline('.')[char_before - 1] !~ '\k'
"return "\<tab>"
"elseif "backward" == a:direction
"return "\<c-p>"
"else
"return "\<c-n>"
"endif
"endfu
"inoremap <tab> <c-r>=InsertTabWrapper("forward")<cr>
"inoremap <s-tab> <c-r>=InsertTabWrapper("backward")<cr>
" javascript fold
au FileType javascript call JavaScriptFold()
" javascript libs
let g:used_javascript_libs = 'jquery,angularjs,angulaui'
" less compilation
nnoremap <Leader>m :w <BAR> !lessc % > %:t:r.css<CR><space>
" jump to last tab by leader tl
let g:lasttab = 1
nmap <leader>l :exe "tabn ".g:lasttab<CR>
au TabLeave * let g:lasttab = tabpagenr()
" map common typos
cabbrev W w
cabbrev Q q
cabbrev E e
" easier session
cabbrev S SaveSession
cabbrev O OpenSession
" nerd tree change current dir
let g:NERDTreeChDirMode = 2
" auto save the session on quit
let g:session_autosave = 'yes'
" auto save the session periodically
let g:session_autosave_periodic = 5
" fix backspace
set backspace=indent,eol,start
В качестве запоздалой мысли я полагаю, что фон текстов на первом изображении правильный, но фон всего экрана неправильный. Мне все еще интересно почему.