From 2d8c33c1e268c65c34cfe868329d0f143cbe4041 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sat, 23 Jul 2022 02:55:31 -0400 Subject: [PATCH] add compatability for neovim < 0.5 --- .vimrc | 5 +++++ .vimrc.bundles | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.vimrc b/.vimrc index c6ca457..daf7d2f 100644 --- a/.vimrc +++ b/.vimrc @@ -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 = '_' diff --git a/.vimrc.bundles b/.vimrc.bundles index ef078ec..5841ce8 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -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 bg :call ToggleBG() - 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