runtime(hare): update for Hare 0.25.2

closes: #18222

Signed-off-by: Amelia Clarke <selene@perilune.dev>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Amelia Clarke
2025-09-08 15:30:41 -04:00
committed by Christian Brabandt
parent 6bb16d2cee
commit 6d68508e62
11 changed files with 860 additions and 411 deletions

View File

@ -1,77 +1,134 @@
*ft_hare.txt* Support for the Hare programming language
==============================================================================
CONTENTS *hare*
CONTENTS *hare* *hare.vim*
1. Introduction |hare-intro|
2. Filetype plugin |hare-plugin|
3. Settings |hare-settings|
1. Introduction |ft-hare-intro|
2. Filetype plugin |ft-hare-plugin|
3. Haredoc filetype |ft-haredoc-plugin|
4. Indentation settings |ft-hare-indent|
5. Compiler support |compiler-hare|
==============================================================================
INTRODUCTION *hare-intro*
INTRODUCTION *ft-hare-intro*
This plugin provides syntax highlighting, indentation, and other functionality
for the Hare programming language. Support is also provided for README files
inside Hare modules, but this must be enabled by setting |g:filetype_haredoc|.
This plugin provides syntax highlighting, indentation, and other supporting
functionality for the Hare programming language.
==============================================================================
FILETYPE PLUGIN *hare-plugin*
This plugin automatically sets the value of 'path' to include the contents of
the HAREPATH environment variable, allowing commands such as |gf| to directly
open standard library or third-party modules. If HAREPATH is not set, it
defaults to the recommended paths for most Unix-like filesystems, namely
/usr/src/hare/stdlib and /usr/src/hare/third-party.
FILETYPE PLUGIN *ft-hare-plugin*
==============================================================================
SETTINGS *hare-settings*
This plugin has a few different variables that can be defined inside your
|vimrc| to tweak its behavior.
This plugin provides a small number of variables that you can define in your
vimrc to configure its behavior.
Additionally, support is provided for folding `{ }` blocks. To enable folding,
add the following to a file inside your |after-directory| (e.g.
~/.vim/after/ftplugin/hare.vim): >
*g:filetype_haredoc*
This plugin is able to automatically detect Hare modules and set the "haredoc"
filetype for any README files. As the recursive directory search used as a
heuristic has a minor performance impact, this feature is disabled by default
and must be specifically opted into: >
let g:filetype_haredoc = 1
<
See |g:haredoc_search_depth| for ways to tweak the searching behavior.
setlocal foldmethod=syntax
Because block-based folding tends to create many small folds, consider setting
a few related options, such as 'foldminlines' and 'foldnestmax'.
*g:hare_recommended_style*
The following options are set by default, in accordance with the official Hare
The following options are set by default, in accordance with Hare's official
style guide: >
setlocal noexpandtab
setlocal shiftwidth=0
setlocal softtabstop=0
setlocal tabstop=8
setlocal textwidth=80
<
To disable this behavior: >
To disable this behavior, add the following to your |vimrc|: >
let g:hare_recommended_style = 0
<
*g:hare_space_error*
By default, trailing whitespace and tabs preceded by space characters are
highlighted as errors. This is automatically turned off when in insert mode.
To disable this highlighting completely: >
let g:hare_space_error = 0
<
*g:haredoc_search_depth*
By default, when |g:filetype_haredoc| is enabled, only the current directory
and its immediate subdirectories are searched for Hare files. The maximum
search depth may be adjusted with: >
let g:haredoc_search_depth = 2
<
Value Effect~
0 Only search the current directory.
1 Search the current directory and immediate
subdirectories.
2 Search the current directory and two levels of
subdirectories.
*g:hare_symbol_operators*
By default, symbolic operators do not receive any special highlighting (with
`!`, `?`, and `::` being the only exceptions). To enable syntax highlighting
for most other operators, add the following to your |vimrc|: >
The maximum search depth can be set to any integer, but using values higher
than 2 is not recommended, and will likely provide no tangible benefit in most
situations.
let g:hare_symbol_operators = 1
<
*g:hare_space_error*
By default, trailing whitespace and spaces followed by <Tab> characters will
be highlighted as errors. This is automatically disabled in Insert mode. To
turn off this highlighting completely, add the following to your |vimrc|: >
let g:hare_space_error = 0
HAREDOC FILETYPE *ft-haredoc-plugin*
This plugin will automatically detect README files inside Hare modules, using
a recursive directory search, and give them the "haredoc" filetype. Because
this is such a common filename, this plugin only searches for Hare source
files within the same directory by default.
*g:filetype_haredoc*
The |g:filetype_haredoc| variable can be used to tweak the depth of this
search, or bypass the detection of Hare documentation files altogether:
Value Effect~
0 No automatic detection
1 Search current directory only (this is the default)
2 Search one level of subdirectories
3 Search two levels of subdirectories
The search depth may be any positive integer, but values higher than `2` are
unlikely to provide a tangible benefit in most situations.
INDENTATION SETTINGS *ft-hare-indent*
Unlike most other settings for this plugin, the indentation settings may also
be set per-buffer, overriding any global configuration that exists. To do
this, simply prefix the variable with |b:| instead of |g:|.
*g:hare_indent_match_switch*
By default, continuation lines for "match" and "switch" conditions are
indented only one level: >hare
const file = match (os::create(path, 0o644,
flag::WRONLY | flag::TRUNC)) {
case let file: io::file =>
yield file;
// ...
If you instead prefer indenting them two levels, to more closely resemble "if"
and "for" conditions, add the following line to your |vimrc|: >
let g:hare_indent_match_switch = 2
<
*g:hare_indent_case*
By default, continuation lines for cases in "match" and "switch" expressions
are indented two levels, to visually distinguish them from the body of the
case: >hare
case ltok::I8, ltok::I16, ltok::I32,
ltok::I64, ltok::INT =>
// ...
If you prefer a different amount of indentation, you can adjust it using
|g:hare_indent_case|. Valid values include `0`, `1`, and `2`.
COMPILER SUPPORT *compiler-hare*
If this plugin detects a Makefile in the current directory, it will assume you
wish to use `make` for your build system, and will leave 'makeprg' untouched.
Otherwise, `hare build` will be used.
*g:hare_makeprg_params*
When `hare build` is used, additional compiler options may be appended to
'makeprg' with the |g:hare_makeprg_params| variable. It may also be set on a
per-buffer basis (using |b:| instead of |g:|), overriding any global
configuration that exists. For example: >
let b:hare_makeprg_params = '-lc -t o'
The global default is "-q", to suppress writing to stdout while building.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:
vim:ft=help:noet:ts=8:tw=78:norl: