neovimopenbsd

How to tell if the current operating system is OpenBSD in NeoVim?


I use NeoVim on two machines, one running OpenBSD and another running Linux. I want to be able to run/load certain commands if I'm on the OpenBSD machine. How can I do this? I've tried the following but it doesn't seem to work.

if vim.fn.has('openbsd') then
  ... do stuff ...
end

Solution

  • With Neovim, you can use Vim functions to get OS name :

    vim.loop.os_uname().sysname