2

I'm trying to find where the help function/command is defined.
So far I tried:

:verbose function help

but since the h isn't in uppercase, it doesn't work (not sure if it's even a function at this point...)

Tried:

:verbose command help

This reports that it's not user-defined, though it's obvious since it's in the default Vim.

Last, I tried going into the /usr/share/vim/ directory, and running a mass grep script to search for any string/and or file that have function! help, help etc.

I looked into the Vim manual but I am not sure I found anything so far. Any (no pun intended) help would be appreciated.

3

The :help command, just like every other built-in commands, is defined in the C code that is compiled into the Vim binary.

You can find in src/ex_cmds.c in the Vim source code.

(Note also that user-defined commands are only allowed to start with an uppercase, precisely to separate them from built-in commands. Also, functions and commands are completely separate namespaces, a function needs to be evaluated with :call or as part as an expression, while a command is directly invoked after the : that puts you in Ex mode.)

2
  • is there a command or function to know where one is located/defined? (for other things beside help). Since I'm assuming that not every builtin are in the C code, though that would help in that case too. – Nordine Lotfi Sep 8 '20 at 3:42
  • 1
    Yes, every built-in command and function in Vim is defined in C code. – filbranden Sep 8 '20 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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