I can check vim's version by using
and I can check if I am running in nvim by doing
has('nvim'). Is there a variable like
v:version in neovim to let me know the nvim version, like
There is probably a direct way (?); if not, here's a function that parses
:version to extract and return the actual value (as string):
function! GetNVimVersion() redir => s silent! version redir END return matchstr(s, 'NVIM v\zs[^\n]*') endfunction
.. so that you can show it with:
echo GetNVimVersion() or store it in some variable.
If you really want to get the version, instead of just checking if the editor is a specific patch, just use
v:lua.vim.version(). That is a special variable that can call into the Lua scripting functions, and just returns a Dictionary (vimscript's associative array). Use
:echo v:lua.vim.version() in command mode to see its values.
if v:lua.vim.version().major == 0 && v:lua.vim.version().minor < 8 " Run this only on older versions. endif