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'))
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
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs

View File

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