ft_hare.txt (4539B)
1 *ft_hare.txt* Support for the Hare programming language 2 3 ============================================================================== 4 CONTENTS *hare* *hare.vim* 5 6 1. Introduction |ft-hare-intro| 7 2. Filetype plugin |ft-hare-plugin| 8 3. Haredoc filetype |ft-haredoc-plugin| 9 4. Indentation settings |ft-hare-indent| 10 5. Compiler support |compiler-hare| 11 12 ============================================================================== 13 INTRODUCTION *ft-hare-intro* 14 15 This plugin provides syntax highlighting, indentation, and other supporting 16 functionality for the Hare programming language. 17 18 19 FILETYPE PLUGIN *ft-hare-plugin* 20 21 This plugin has a few different variables that can be defined inside your 22 |vimrc| to adjust its behavior. 23 24 *hare-folding* 25 This plugin supports folding `{ }` blocks. To enable folding, add the 26 following to a file inside your |after-directory| (e.g. 27 ~/.vim/after/ftplugin/hare.vim): > 28 29 setlocal foldmethod=syntax 30 31 Because syntax-based folding tends to create many small folds, consider 32 setting a few related options, such as 'foldminlines' or 'foldnestmax'. 33 34 *hare-symbol-operators* 35 Most symbolic operators do not receive any highlighting by default (with the 36 exception of "?", "!", and "::"). If you prefer highlighting all operators, 37 you can link them to your preferred highlight group inside your |vimrc|. For 38 example: > 39 40 hi def link hareCast hareSymbolOperator 41 hi def link hareSymbolOperator hareOperator 42 < 43 *g:hare_recommended_style* 44 The following options are set by default, in accordance with Hare's official 45 style guide: > 46 47 setlocal noexpandtab 48 setlocal shiftwidth=8 49 setlocal softtabstop=0 50 setlocal tabstop=8 51 setlocal textwidth=80 52 53 To disable this behavior, add the following to your |vimrc|: > 54 55 let g:hare_recommended_style = 0 56 < 57 *g:hare_space_error* 58 By default, trailing whitespace and spaces followed by <Tab> characters are 59 highlighted as errors. This is automatically disabled while in insert mode. 60 To turn off this highlighting completely, add the following to your |vimrc|: > 61 62 let g:hare_space_error = 0 63 64 65 HAREDOC FILETYPE *ft-haredoc-plugin* 66 67 This plugin will automatically detect README files inside Hare modules, using 68 a recursive directory search, and give them the "haredoc" filetype. Because 69 this is such a common filename, this plugin only searches for Hare source 70 files within the same directory by default. 71 72 *g:filetype_haredoc* 73 The `g:filetype_haredoc` variable can be used to tweak the depth of this 74 search, or bypass the detection of Hare documentation files altogether: 75 76 Value Effect~ 77 0 Search disabled 78 1 Search current directory only (this is the default) 79 2 Search one level of subdirectories 80 81 The search depth may be any positive integer, but values greater than 2 are 82 very unlikely to provide any tangible benefit and can impact performance. 83 84 85 INDENTATION SETTINGS *ft-hare-indent* 86 87 Unlike other settings, indentation settings may be configured on a per-buffer 88 basis, overriding any existing global configuration. To do so, simply prefix 89 the variable with |b:| instead of |g:|. 90 91 *g:hare_indent_match_switch* *b:hare_indent_match_switch* 92 By default, the continuation lines for "match" and "switch" conditions are 93 only indented one level: >hare 94 95 const file = match (os::create(path, 0o644, 96 flag::WRONLY | flag::TRUNC)) { 97 case let file: io::file => 98 yield file; 99 // ... 100 101 If you prefer indenting them two levels, more closely resembling "if" and 102 "for" conditions, add the following line to your |vimrc|: > 103 104 let g:hare_indent_match_switch = 2 105 < 106 *g:hare_indent_case* *b:hare_indent_case* 107 By default, the continuation lines for "match" and "switch" cases are indented 108 two levels, to visually distinguish them from the case body: >hare 109 110 case ltok::I8, ltok::I16, ltok::I32, 111 ltok::I64, ltok::INT => 112 // ... 113 114 If you prefer a different level of indentation, you can adjust it using 115 `g:hare_indent_case`. The possible values are 0, 1, and 2. 116 117 118 COMPILER SUPPORT *compiler-hare* 119 120 If a Makefile is detected in the current directory, this plugin will assume 121 you are using "make" for your build system, and will leave 'makeprg' as-is. 122 Otherwise, "hare build" will be used. 123 124 *g:hare_makeprg_params* 125 When using "hare build", additional compiler options may be appended to 126 'makeprg' using `g:hare_makeprg_params`. The default is "-q", to suppress 127 printing to stdout when building. 128 129 ============================================================================== 130 vim:tw=78:ts=8:noet:ft=help:norl: