summaryrefslogtreecommitdiff
path: root/mnv/runtime/doc/ft_hare.txt
blob: 5f5af6a4cf7c77bbfabfce536b47cd5969fd4864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
*ft_hare.txt*	Support for the Hare programming language

==============================================================================
CONTENTS						*hare* *hare.mnv*

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						*ft-hare-intro*

This plugin provides syntax highlighting, indentation, and other supporting
functionality for the Hare programming language.


FILETYPE PLUGIN						*ft-hare-plugin*

This plugin has a few different variables that can be defined inside your
|mnvrc| to adjust its behavior.

							*hare-folding*
This plugin supports folding `{ }` blocks.  To enable folding, add the
following to a file inside your |after-directory| (e.g.
~/.mnv/after/ftplugin/hare.mnv): >

	setlocal foldmethod=syntax

Because syntax-based folding tends to create many small folds, consider
setting a few related options, such as 'foldminlines' or 'foldnestmax'.

						*hare-symbol-operators*
Most symbolic operators do not receive any highlighting by default (with the
exception of "?", "!", and "::").  If you prefer highlighting all operators,
you can link them to your preferred highlight group inside your |mnvrc|.  For
example: >

	hi def link hareCast hareSymbolOperator
	hi def link hareSymbolOperator hareOperator
<
						*g:hare_recommended_style*
The following options are set by default, in accordance with Hare's official
style guide: >

	setlocal noexpandtab
	setlocal shiftwidth=8
	setlocal softtabstop=0
	setlocal tabstop=8
	setlocal textwidth=80

To disable this behavior, add the following to your |mnvrc|: >

	let g:hare_recommended_style = 0
<
							*g:hare_space_error*
By default, trailing whitespace and spaces followed by <Tab> characters are
highlighted as errors.  This is automatically disabled while in insert mode.
To turn off this highlighting completely, add the following to your |mnvrc|: >

	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		Search disabled
	1		Search current directory only (this is the default)
	2		Search one level of subdirectories

The search depth may be any positive integer, but values greater than 2 are
very unlikely to provide any tangible benefit and can impact performance.


INDENTATION SETTINGS					*ft-hare-indent*

Unlike other settings, indentation settings may be configured on a per-buffer
basis, overriding any existing global configuration.  To do so, simply prefix
the variable with |b:| instead of |g:|.

		*g:hare_indent_match_switch* *b:hare_indent_match_switch*
By default, the continuation lines for "match" and "switch" conditions are
only indented one level: >hare

	const file = match (os::create(path, 0o644,
		flag::WRONLY | flag::TRUNC)) {
	case let file: io::file =>
		yield file;
	// ...

If you prefer indenting them two levels, more closely resembling "if" and
"for" conditions, add the following line to your |mnvrc|: >

	let g:hare_indent_match_switch = 2
<
				*g:hare_indent_case* *b:hare_indent_case*
By default, the continuation lines for "match" and "switch" cases are indented
two levels, to visually distinguish them from the case body: >hare

	case ltok::I8, ltok::I16, ltok::I32,
			ltok::I64, ltok::INT =>
		// ...

If you prefer a different level of indentation, you can adjust it using
`g:hare_indent_case`.  The possible values are 0, 1, and 2.


COMPILER SUPPORT					*compiler-hare*

If a Makefile is detected in the current directory, this plugin will assume
you are using "make" for your build system, and will leave 'makeprg' as-is.
Otherwise, "hare build" will be used.

						*g:hare_makeprg_params*
When using "hare build", additional compiler options may be appended to
'makeprg' using `g:hare_makeprg_params`.  The default is "-q", to suppress
printing to stdout when building.

==============================================================================
 mnv:tw=78:ts=8:noet:ft=help:norl: