runtime(erlang): Add support for triple-quoted strings and docstrings

Erlang recently added the `-moduledoc` attribute as well as triple
quoted strings and the `~` prefix for binary strings, see [1].

Erlang also added nominal types. See EEP-69 [2].

This commit removes the documentation of "g:erlang_highlight_bifs" and
"g:erlang_highlight_special_atoms", which are not longer supported.
"g:erlang_old_style_highlight" is kept undocumented (as it should not be
used by new users).

This commit contains the modifications in the following PR and commits:

- vim-erlang/vim-erlang-runtime#58
- vim-erlang/vim-erlang-runtime@43d18d3
- vim-erlang/vim-erlang-runtime@ac88ebf
- vim-erlang/vim-erlang-runtime@19c1be9
- vim-erlang/vim-erlang-runtime@7f5cefc
- vim-erlang/vim-erlang-runtime@976b10b

[1]: https://www.erlang.org/doc/system/documentation.html
[2]: https://www.erlang.org/eeps/eep-0069

closes: #17687

Co-authored-by: Johannes Christ <jc@jchri.st>
Signed-off-by: Csaba Hoch <csaba@cursorinsight.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Csaba Hoch
2025-07-14 22:02:18 +02:00
committed by Christian Brabandt
parent d0bf380efa
commit e85a66a4d4
2 changed files with 191 additions and 17 deletions

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 9.1. Last change: 2025 Jun 03
*syntax.txt* For Vim version 9.1. Last change: 2025 Jul 14
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1573,15 +1573,47 @@ ERLANG *erlang.vim* *ft-erlang-syntax*
Erlang is a functional programming language developed by Ericsson. Files with
the following extensions are recognized as Erlang files: erl, hrl, yaws.
The BIFs (built-in functions) are highlighted by default. To disable this,
put the following line in your vimrc: >
Vim highlights triple-quoted docstrings as comments by default.
:let g:erlang_highlight_bifs = 0
If you want triple-quoted docstrings highlighted as Markdown, add the
following line to your |.vimrc|: >
To enable highlighting some special atoms, put this in your vimrc: >
:let g:erlang_use_markdown_for_docs = 1
:let g:erlang_highlight_special_atoms = 1
The plain text inside the docstrings (that is, the characters that are not
highlighted by the Markdown syntax) is still highlighted as a comment.
If you want to highlight the plain text inside the docstrings using a
different highlight group, add the following line to your |.vimrc| (the
example highlights plain text using the String highlight group): >
:let g:erlang_docstring_default_highlight = 'String'
If you don't enable Markdown, this line highlights the full docstrings
according to the specified highlight group.
Use the following line to disable highlighting for the plain text: >
:let g:erlang_docstring_default_highlight = ''
Configuration examples: >
" Highlight docstrings as Markdown.
:let g:erlang_use_markdown_for_docs = 1
" 1. Highlight Markdown elements in docstrings as Markdown.
" 2. Highlight the plain text in docstrings as String.
:let g:erlang_use_markdown_for_docs = 1
:let g:erlang_docstring_default_highlight = 'String'
" Highlight docstrings as strings (no Markdown).
:let g:erlang_docstring_default_highlight = 'String'
" 1. Highlight Markdown elements in docstrings as Markdown.
" 2. Don't highlight the plain text in docstrings.
:let g:erlang_use_markdown_for_docs = 1
:let g:erlang_docstring_default_highlight = ''
<
ELIXIR *elixir.vim* *ft-elixir-syntax*