From 429ce94da17d850ea022cf7bf188ec676e4c7be7 Mon Sep 17 00:00:00 2001 From: siduck Date: Tue, 26 Jul 2022 13:05:58 +0000 Subject: [PATCH] store vim version in global for v0.8 compatibility checks so we dont have to run vim.version() function in many places of the config cuz we will be making nvchad 0.8 compatible too bit by bit --- lua/core/options.lua | 4 ++-- lua/plugins/configs/lspconfig.lua | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lua/core/options.lua b/lua/core/options.lua index d8f7fe75..66733034 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -1,15 +1,15 @@ local opt = vim.opt local g = vim.g local config = require("core.utils").load_config() -local vim_version = vim.version() +g.vim_version = vim.version().minor g.nvchad_theme = config.ui.theme g.toggle_theme_icon = "  " g.transparency = config.ui.transparency g.theme_switcher_loaded = false -- use filetype.lua instead of filetype.vim. it's enabled by default in neovim 0.8 (nightly) -if vim_version.minor < 8 then +if g.vim_version < 8 then g.did_load_filetypes = 0 g.do_filetype_lua = 1 end diff --git a/lua/plugins/configs/lspconfig.lua b/lua/plugins/configs/lspconfig.lua index f69c5c3d..4b83eab6 100644 --- a/lua/plugins/configs/lspconfig.lua +++ b/lua/plugins/configs/lspconfig.lua @@ -13,9 +13,7 @@ local utils = require "core.utils" -- export on_attach & capabilities for custom lspconfigs M.on_attach = function(client, bufnr) - local vim_version = vim.version() - - if vim_version.minor > 7 then + if vim.g.vim_version > 7 then -- nightly client.server_capabilities.documentFormattingProvider = false client.server_capabilities.documentRangeFormattingProvider = false