Skip to content

docs: vim.fn.has misleading examples #35614

@goldeneas

Description

@goldeneas

Problem

The vim.fn.has docs state the following:

2. Runtime condition or other pseudo-feature.
For example "win32" feature checks if the current system is Windows:
	if has("win32")
		 ...
	endif

However running:
:lua if(vim.fn.has("win32")) then print("hello!") end
prints 'hello!' even when on linux

Instead if you run:
:lua if(vim.fn.has("win32") == 1) then print("hello!") end
nothing is printed

Steps to reproduce

:lua if(vim.fn.has("win32")) then print("hello!") end

when on not-Windows

Expected behavior

Docs should be updated

Nvim version (nvim -v)

0.11.0

Vim (not Nvim) behaves the same?

no

Operating system/version

Ubuntu 24.04 LTS

Terminal name/version

Wezterm

$TERM environment variable

xterm-256color

Installation

apt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions