From b979b3d8ceac1daf4f22dfd2156cba8fea3ef905 Mon Sep 17 00:00:00 2001 From: Aaron Pham Date: Sun, 18 Aug 2024 06:28:11 -0400 Subject: [PATCH] chore(init): gated neovim version (#67) Signed-off-by: Aaron Pham --- README.md | 4 ++++ lua/avante/init.lua | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 8213a08..2e1d2ea 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ Install `avante.nvim` using [lazy.nvim](https://github.com/folke/lazy.nvim): } ``` +> [!IMPORTANT] +> +> `avante.nvim` is currently only compatible with Neovim 0.10.0 or later. Please ensure that your Neovim version meets these requirements before proceeding. + > [!IMPORTANT] > > If your neovim doesn't use LuaJIT, then change `build` to `make lua51`. By default running make will install luajit. diff --git a/lua/avante/init.lua b/lua/avante/init.lua index 2216a14..f045382 100644 --- a/lua/avante/init.lua +++ b/lua/avante/init.lua @@ -185,6 +185,16 @@ end ---@param opts? avante.Config function M.setup(opts) + if vim.fn.has("nvim-0.10") == 0 then + vim.api.nvim_echo({ + { "Avante requires at least nvim-0.10", "ErrorMsg" }, + { "Please upgrade your neovim version", "WarningMsg" }, + { "Press any key to exit", "ErrorMsg" }, + }, true, {}) + vim.fn.getchar() + vim.cmd([[quit]]) + end + ---PERF: we can still allow running require("avante").setup() multiple times to override config if users wish to ---but most of the other functionality will only be called once from lazy.nvim Config.setup(opts)