summaryrefslogtreecommitdiff
path: root/vim/bundle/rust.vim/doc/rust.txt
blob: 68fc1da04967bebb09c70f48f7cb90bf3843185f (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
*rust.txt*      Filetype plugin for Rust

==============================================================================
CONTENTS                                                      *rust* *ft-rust*

1. Introduction                                                   |rust-intro|
2. Settings                                                    |rust-settings|
3. Commands                                                    |rust-commands|
4. Mappings                                                    |rust-mappings|

==============================================================================
INTRODUCTION                                                      *rust-intro*

This plugin provides syntax and supporting functionality for the Rust
filetype.

==============================================================================
SETTINGS                                                       *rust-settings*

This plugin has a few variables you can define in your vimrc that change the
behavior of the plugin.

                                                                *g:rustc_path*
g:rustc_path~
	Set this option to the path to rustc for use in the |:RustRun| and
	|:RustExpand| commands. If unset, "rustc" will be located in $PATH: >
	    let g:rustc_path = $HOME."/bin/rustc"
<

                                                  *g:rustc_makeprg_no_percent*
g:rustc_makeprg_no_percent~
	Set this option to 1 to have 'makeprg' default to "rustc" instead of
	"rustc %": >
	    let g:rustc_makeprg_no_percent = 1
<

                                                              *g:rust_conceal*
g:rust_conceal~
	Set this option to turn on the basic |conceal| support: >
	    let g:rust_conceal = 1
<

                                                     *g:rust_conceal_mod_path*
g:rust_conceal_mod_path~
	Set this option to turn on |conceal| for the path connecting token
	"::": >
	    let g:rust_conceal_mod_path = 1
<

                                                          *g:rust_conceal_pub*
g:rust_conceal_pub~
	Set this option to turn on |conceal| for the "pub" token: >
	    let g:rust_conceal_pub = 1
<

                                                     *g:rust_recommended_style*
g:rust_recommended_style~
        Set this option to enable vim indentation and textwidth settings to
        conform to style conventions of the rust standard library (i.e. use 4
        spaces for indents and sets 'textwidth' to 99). This option is enabled
	by default. To disable it: >
	    let g:rust_recommended_style = 0
<

                                                                 *g:rust_fold*
g:rust_fold~
	Set this option to turn on |folding|: >
	    let g:rust_fold = 1
<
	Value		Effect ~
	0		No folding
	1		Braced blocks are folded. All folds are open by
			default.
	2		Braced blocks are folded. 'foldlevel' is left at the
			global value (all folds are closed by default).

                                                  *g:rust_bang_comment_leader*
g:rust_bang_comment_leader~
	Set this option to 1 to preserve the leader on multi-line doc comments
	using the /*! syntax: >
	    let g:rust_bang_comment_leader = 1
<

                                                 *g:ftplugin_rust_source_path*
g:ftplugin_rust_source_path~
	Set this option to a path that should be prepended to 'path' for Rust
	source files: >
	    let g:ftplugin_rust_source_path = $HOME.'/dev/rust'
<

                                                       *g:rustfmt_command*
g:rustfmt_command~
	Set this option to the name of the 'rustfmt' executable in your $PATH. If
	not specified it defaults to 'rustfmt' : >
	    let g:rustfmt_command = 'rustfmt'
<
                                                       *g:rustfmt_autosave*
g:rustfmt_autosave~
	Set this option to 1 to run |:RustFmt| automatically when saving a
	buffer. If not specified it defaults to 0 : >
	    let g:rustfmt_autosave = 0
<
                                                       *g:rustfmt_fail_silently*
g:rustfmt_fail_silently~
	Set this option to 1 to prevent 'rustfmt' from populating the
	|location-list| with errors. If not specified it defaults to 0: >
	    let g:rustfmt_fail_silently = 0
<
                                                       *g:rustfmt_options*
g:rustfmt_options~
	Set this option to a string of options to pass to 'rustfmt'. The
	write-mode is already set to 'overwrite'. If not specified it
	defaults to '' : >
	    let g:rustfmt_options = ''
<

                                                          *g:rust_playpen_url*
g:rust_playpen_url~
	Set this option to override the url for the playpen to use: >
	    let g:rust_playpen_url = 'https://play.rust-lang.org/'
<

                                                        *g:rust_shortener_url*
g:rust_shortener_url~
	Set this option to override the url for the url shortener: >
	    let g:rust_shortener_url = 'https://is.gd/'
<


==============================================================================
COMMANDS                                                       *rust-commands*

:RustRun  [args]                                                    *:RustRun*
:RustRun! [rustc-args] [--] [args]
		Compiles and runs the current file. If it has unsaved changes,
		it will be saved first using |:update|. If the current file is
		an unnamed buffer, it will be written to a temporary file
		first. The compiled binary is always placed in a temporary
		directory, but is run from the current directory.

		The arguments given to |:RustRun| will be passed to the
		compiled binary.

		If ! is specified, the arguments are passed to rustc instead.
		A "--" argument will separate the rustc arguments from the
		arguments passed to the binary.

		If |g:rustc_path| is defined, it is used as the path to rustc.
		Otherwise it is assumed rustc can be found in $PATH.

:RustExpand  [args]                                              *:RustExpand*
:RustExpand! [TYPE] [args]
		Expands the current file using --pretty and displays the
		results in a new split. If the current file has unsaved
		changes, it will be saved first using |:update|. If the
		current file is an unnamed buffer, it will be written to a
		temporary file first.

		The arguments given to |:RustExpand| will be passed to rustc.
		This is largely intended for specifying various --cfg
		configurations.

		If ! is specified, the first argument is the expansion type to
		pass to rustc --pretty. Otherwise it will default to
		"expanded".

		If |g:rustc_path| is defined, it is used as the path to rustc.
		Otherwise it is assumed rustc can be found in $PATH.

:RustEmitIr [args]                                               *:RustEmitIr*
		Compiles the current file to LLVM IR and displays the results
		in a new split. If the current file has unsaved changes, it
		will be saved first using |:update|. If the current file is an
		unnamed buffer, it will be written to a temporary file first.

		The arguments given to |:RustEmitIr| will be passed to rustc.

		If |g:rustc_path| is defined, it is used as the path to rustc.
		Otherwise it is assumed rustc can be found in $PATH.

:RustEmitAsm [args]                                             *:RustEmitAsm*
		Compiles the current file to assembly and displays the results
		in a new split. If the current file has unsaved changes, it
		will be saved first using |:update|. If the current file is an
		unnamed buffer, it will be written to a temporary file first.

		The arguments given to |:RustEmitAsm| will be passed to rustc.

		If |g:rustc_path| is defined, it is used as the path to rustc.
		Otherwise it is assumed rustc can be found in $PATH.

:RustPlay                                                          *:RustPlay*
		This command will only work if you have web-api.vim installed
		(available at https://github.com/mattn/webapi-vim).  It sends the
		current selection, or if nothing is selected, the entirety of the
		current buffer to the Rust playpen, and emits a message with the
		shortened URL to the playpen.

		|g:rust_playpen_url| is the base URL to the playpen, by default
		"https://play.rust-lang.org/".

		|g:rust_shortener_url| is the base url for the shorterner, by
		default "https://is.gd/"

:RustFmt                                                       *:RustFmt*
		Runs |g:rustfmt_command| on the current buffer. If
		|g:rustfmt_options| is set then those will be passed to the
		executable.

		If |g:rustfmt_fail_silently| is 0 (the default) then it
		will populate the |location-list| with the errors from
		|g:rustfmt_command|. If |g:rustfmt_fail_silently| is set to 1
		then it will not populate the |location-list|.

:RustFmtRange                                                  *:RustFmtRange*
		Runs |g:rustfmt_command| with selected range. See
		|:RustFmt| for any other information.

==============================================================================
MAPPINGS                                                       *rust-mappings*

This plugin defines mappings for |[[| and |]]| to support hanging indents.

It also has a few other mappings:

							*rust_<D-r>*
<D-r>			Executes |:RustRun| with no arguments.
			Note: This binding is only available in MacVim.

							*rust_<D-R>*
<D-R>			Populates the command line with |:RustRun|! using the
			arguments given to the last invocation, but does not
			execute it.
			Note: This binding is only available in MacVim.

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