Improve colorscheme and gui detection

This commit is contained in:
ViViDboarder 2017-11-01 14:27:30 -07:00
parent 8f93dd590d
commit b899f3f379
2 changed files with 16 additions and 9 deletions

View File

@ -40,6 +40,12 @@ function! IsMac()
\ system('uname') =~? '^darwin')) \ system('uname') =~? '^darwin'))
endfunction endfunction
function! IsGuiApp()
return has("gui_running") || exists("neovim_dot_app")
\ || has("gui_win32") || has("gui_macvim")
\ || has("gui_vimr")
endfunction
" Auto install vim-plug " Auto install vim-plug
if empty(glob('~/.vim/autoload/plug.vim')) if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs

View File

@ -13,18 +13,14 @@ syntax on
" Enable search highlighting " Enable search highlighting
set hls set hls
" Color Schemes {{ " Color Schemes {{
" Set theme based on $VIM_COLOR variable " Set theme based on $VIM_COLOR variable
try try
if !empty($VIM_COLOR) if !empty($VIM_COLOR)
colorscheme $VIM_COLOR colorscheme $VIM_COLOR
else else
if has("gui_running") || exists("neovim_dot_app") " Prefered default colorscheme
colorscheme wombat256mod colorscheme wombat256mod
else
colorscheme vividchalk
endif
endif endif
catch /^Vim\%((\a\+)\)\=:E185/ catch /^Vim\%((\a\+)\)\=:E185/
" Colorschemes not installed yet " Colorschemes not installed yet
@ -32,6 +28,11 @@ catch /^Vim\%((\a\+)\)\=:E185/
colorscheme default colorscheme default
endtry endtry
" Override gui colorscheme
if IsGuiApp()
colorscheme wombat256mod
endif
" Set Airline theme " Set Airline theme
if g:colors_name == 'github' if g:colors_name == 'github'
let g:airline_theme = 'solarized' let g:airline_theme = 'solarized'
@ -39,10 +40,10 @@ endif
" }} " }}
" Set gui fonts {{ " Set gui fonts {{
if has("gui_running") || exists("neovim_dot_app") if IsGuiApp()
if has("gui_win32") if IsWindows()
set guifont=Consolas:h10:b set guifont=Consolas:h10:b
elseif IsMac() && (has("gui_macvim") || exists("neovim_dot_app")) elseif IsMac()
try try
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11 set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11
catch catch