Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhuster committed Nov 7, 2024
1 parent 7e4e46b commit ce32525
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ autosave.nvim is a Neovim and Vim plugin that provides automatic saving function

# Installation

This plugin requires Neovim or Vim >=8.2 compiled with Lua support. You can check if your version of Vim supports Lua by running `:echo has("lua")` in the editor.
This plugin requires Neovim >=0.9 or Vim >=8.2 compiled with Lua support. You can check if your version of Vim supports Lua by running `:echo has("lua")` in the editor.

<details>
<summary>Using lazy.nvim (recommended) 💤</summary>
Expand Down
20 changes: 20 additions & 0 deletions lua/autosave/health.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
if vim.fn.has('nvim') == 0 then
print("`:checkhealth` is only supported in Neovim")
return
end

local M = {}

local health = vim.health

M.check = function()
health.start('Check requirements')
local vimver = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
if vim.fn.has('nvim-0.9') == 0 then
health.warn('Neovim version is too old', 'Update to Neovim 0.9 or later')
else
health.ok('Neovim version is up to date', vimver)
end
end

return M
8 changes: 5 additions & 3 deletions plugin/autosave.vim
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
let compatible = v:false
if has('nvim')
let min_nvim = '0.9'
let min_vim = '8.2.0'
if has('nvim-' .. min_nvim)
let compatible = v:true
endif
if has("patch-8.2.1066") && has("lua")
if has("patch-" .. min_vim) && has("lua")
let compatible = v:true
endif

if !compatible
echoerr "autosave.vim requires Neovim or Vim >= 8.2.1066 with Lua support"
echoerr printf("autosave.vim requires Neovim %s or Vim %s with +lua feature", min_nvim, min_vim)
finish
endif

Expand Down

0 comments on commit ce32525

Please sign in to comment.