summaryrefslogtreecommitdiffstats
path: root/doc/dart.txt
blob: 2a3bc78e1cfc58cee883cfb40c01d8ae27b2fa32 (plain) (blame)
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
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1

*dart-vim-plugin*  Dart support for Vim

INTRODUCTION                                    *dart.vim*

dart-vim-plugin provides filetype detection, syntax highlighting, and
indentation for Dart code in Vim.

https://github.com/dart-lang/dart-vim-plugin

TOOLS                                           *dart-tools*

An `includeexpr` is set that can read `.packages` files and resolve `package:`
uris to a file. See |gf| for an example use.

COMMANDS                                        *dart-commands*

These commands are available in buffers with the dart filetype.

                                                *:Dart2Js*
Runs dart2js to compile the current file. Takes the same arguments as the
dart2js binary and always passes the path to the current file as the last
argument.
If there are any errors they will be shown in the quickfix window.

                                                *:DartFmt*
Runs dartfmt and passes the current buffer content through stdin. If the
format is successful replaces the current buffer content with the formatted
result. If the format is unsuccessful errors are shown in the quickfix window.
This command does not use the file content on disk so it is safe to run with
unwritten changes.
Passes arguments through to dartfmt.

                                                *:DartAnalyzer*
Runs dartanalyzer to analyze the current file. Takes the same arguments as the
dartanalyzer binary and always passes the path to the current file as the last
argument.
If there are any errors they will be shown in the quickfix window.

CONFIGURATION                                   *dart-configure*

                                                *g:dart_html_in_string*
Set to `v:true` to highlights HTML syntax inside Strings within Dart files.
Default `v:false`

                                                *g:dart_corelib_highlight*
Set to `v:false` to disable highlighting of code Dart classes like `Map` or
`List`.
Default `v:true`
                                                *g:dart_style_guide*
Set to any value (set to `2` by convention) to set tab and width behavior to
match the Dart style guide - spaces only with an indent of 2. Also sets
`formatoptions += t` to auto wrap text.

Configure DartFmt options with `let g:dartfmt_options`, for example, enable
auto syntax fixes with `let g:dartfmt_options = ['--fix']`
(discover formatter options with `dartfmt -h`)


SYNTAX HIGHLIGHTING                              *dart-syntax*

This plugin uses narrow highlight groups to allow selectively disabling the
syntax highlights. Link any of the following groups to the `Normal` highlight
group to disable them:

`dartSdkException`: Capitalized exception or error classes defined in the SDK.

`dartCoreType`: `void`, `var`, `dynamic`

`dartSdkClass`: Capitalized classes defined in the SDK, along with `bool`,
`int`, `double`, and `num`.

`dartUserType`: Any capitalized identifier.

`dartType`: Combines `dartCoreType`, `dartSdkClass`, and `dartUserType`.

`dartSdkTypedef`: SDK defined `typdef`s.

`dartFunction`: Any lower cased identifier preceding an open parenthesis.

For example, to remove the highlighting for type and function names:
>
 highlight link dartType Normal
 highlight link dartFunction Normal
<

 vim:tw=78:sw=4:ts=8:ft=help:norl:

endif