I can check vim's version by using v:version, 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 0.1.4 or 0.1.6?

  • 2
    Are you testing for a Neovim-only feature? If so, you can just use has('feature') or has('*function_name'). If not, you can still use has("patch-7.4.123") to see if what you need is available. I made the plugin helpful.vim which can help you find the version numbers you would want to test.
    – Tommy A
    Oct 18, 2016 at 13:41
  • As of 0.1.6, you will be able to check has('nvim-1.2.3')
    – Tommy A
    Nov 5, 2016 at 1:51

3 Answers 3


As mentioned in comments elsewhere, you can use has. For generic "is this neovim":

:echo has('nvim')

For at least minor version 0.1 (latest as of this writing):

:echo has('nvim-0.1')

For at least patch version 0.1.6:

:echo has('nvim-0.1.6')

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]*')

.. so that you can show it with: echo GetNVimVersion() or store it in some variable.

  • 5
    Actually, with execute(), this can be more compact: let version = matchstr(execute('version'), 'NVIM v\zs[^\n]*'). But, the function was added in nvim 0.1.5 and vim 7.4.2008
    – Tommy A
    Oct 18, 2016 at 1:35
  • That's good to know, thanks! Although a little ironic in this case - since the version isn't known, adding another branch for this situation - if exists('*execute') - actually makes the code bigger (since you can't rely on the function to exist in your (n)vim - for some time, at least).
    – VanLaser
    Oct 18, 2016 at 9:00
  • From what I noticed, Neovim users tend to upgrade to the latest stable release since they're responsible for accessing distribution channels. Once it's in official package repositories, the problem you mentioned will be a more concrete reality when a version is frozen for a stable OS release. If I'm reading it right, Neovim 0.1.5 will be available in Debian Stretch.
    – Tommy A
    Oct 18, 2016 at 13:37
  • Sure, if I'd need the version number myself, I'd certainly use your execute()-based one liner (because I know what I install).
    – VanLaser
    Oct 18, 2016 at 20:22
  • It was just a thought about figuring out a baseline version if you really had to. The point is moot since the only good reason you'd want to get the version is to print it. I think there are better ways to test capabilities as I mentioned in the OP.
    – Tommy A
    Oct 19, 2016 at 5:33

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.

Example use:

if v:lua.vim.version().major == 0 && v:lua.vim.version().minor < 8
  " Run this only on older versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.