2

I have neovim 0.3.4 installed which means I can run the :terminal command, however, doing :echo has('terminal') shows 0.

So, I wonder if there is any other way I can test for its support because all my terminal mappings wrapped within an if has('terminal)...endif do not work.

According to the vim manual that is the way to test it

The terminal feature is optional, use this to check if your Vim has it: echo has('terminal') If the result is "1" you have it. -- https://vimhelp.org/terminal.txt.html

Thanks

2
  • 2
    neovim always has the terminal included, so you can simply use has('nvim') the other test is for Vim specifically. Mar 8, 2019 at 10:04
  • Exactly, what I needed. Works perfectly Mar 8, 2019 at 10:31

2 Answers 2

9

You can use

if exists(':terminal')

to check for existence of the terminal command. This works in both vim and neovim.

3

As said by Christian Brabandt in the question's comment:

neovim always has the terminal included, so you can simply use has('nvim') the other test is for Vim specifically.

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.