6

How can I list / show all built-in functions, similar to the :function command which lists all (non-builtin?) functions?

2 Answers 2

6

Try this:

new | put! =getcompletion('*', 'function')->filter({_, v -> v =~# '^[a-z][^#]*$'})

Broken down:

  • new - Create a new window and start editing an empty file in it
  • put! - Put the text from a register before the current line
  • = - The expression register
  • getcompletion('*', 'function') - Return a list of command-line completion for all functions
  • ->filter({lambda}) - filter results from the returned list of getcompletion(...) based on the return value of {lambda}
  • {_, v -> v =~# '{pattern}'} - Lambda function that returns 1 if v case sensitively matches {pattern}, else 0
  • ^[a-z][^#]*$'
    • ^ - Start of string
    • [a-z] - Any lowercase letter
    • [^#]* - Any non-# character, 0 or more times
    • $ - End of String

For more info, see:

3

I found a list in :help functions (plural) which is sufficient if there is no command. But it would be nice to find a corollary command to :function -- is there one?

The functions list is also grouped by use here: h: function-list. Eg. it lists string-functions, cursor-functions, and so on.

2
  • 3
    is there anything missing from the help function list or why are you looking for an additional command? Commented Oct 7, 2020 at 5:41
  • It's nice to see a list in isolation, outside the context of help. Also, I was curious if there was a corollary function to ":functions" Commented Oct 11, 2020 at 0:32

Your Answer

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

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