add compatability for neovim < 0.5

This commit is contained in:
Nachuan Tang
2022-07-23 02:55:31 -04:00
parent d6048e7c17
commit 2d8c33c1e2
2 changed files with 10 additions and 6 deletions
+5
View File
@@ -1,5 +1,10 @@
" Modeline and Notes {
" Environment {
" get current neovim version
if has('nvim')
let g:nvim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
endif
" The default leader is '\', but many people prefer ',' as it's in a standard
let mapleader = ','
let maplocalleader = '_'
+5 -6
View File
@@ -157,7 +157,7 @@
" has('nvim') check if it's running on nvim rather than
" having neovim on your machine
if isdirectory(expand(plugin_dir . "/github-nvim-theme")) && has('nvim')
if isdirectory(expand(plugin_dir . "/github-nvim-theme")) && has('nvim') && str2float(g:nvim_version) >= 0.5
let g:github_function_style = "italic"
"let g:github_sidebars = ["qf", "vista_kind", "terminal", "packer"]
colorscheme github_dark
@@ -167,19 +167,20 @@
" Inversion
if g:colors_name == "github_light"
colorscheme github_dark
:AirlineTheme afterglow
else
colorscheme github_light
:AirlineTheme silver
endif
endfunction
noremap <leader>bg :call ToggleBG()<CR>
endif
" }
" {
" vim theme
"if isdirectory(expand(plugin_dir . "/jellybeans.vim")) && !has('nvim')
if isdirectory(expand(plugin_dir . "/vim-afterglow")) && !has('nvim')
"elseif isdirectory(expand(plugin_dir . "/jellybeans.vim")) && !has('nvim')
elseif isdirectory(expand(plugin_dir . "/vim-afterglow"))
colorscheme afterglow
let g:airline_theme='afterglow'
@@ -189,12 +190,10 @@
if g:colors_name == "afterglow"
set background=light
colorscheme PaperColor
"let g:airline_theme='papercolor'
:AirlineTheme papercolor
else
set background=dark
colorscheme afterglow
"let g:airline_theme='afterglow'
:AirlineTheme afterglow
endif
endfunction