6

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

Rob Bednark
  • 371
  • 1
  • 13

2 Answers2

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:

Jake Grossman
  • 1,643
  • 1
  • 4
  • 16
user938271
  • 5,947
  • 1
  • 15
  • 24
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.

markling
  • 359
  • 1
  • 10
Rob Bednark
  • 371
  • 1
  • 13