Home Explore Blog CI



neovim

5th chunk of `runtime/doc/ft_rust.txt`
445ce019ee69c8a8c3b2080db7b92a5d8a411b0b147913d90000000100000eba
 Runs `cargo` with the provided arguments.

:Cbuild <args>                                                     *:Cbuild*
                Shortcut for `cargo build` .

:Cclean <args>                                                     *:Cclean*
                Shortcut for `cargo clean` .

:Cdoc <args>                                                         *:Cdoc*
                Shortcut for `cargo doc` .

:Cinit <args>                                                       *:Cinit*
                Shortcut for `cargo init` .

:Crun <args>                                                         *:Crun*
                Shortcut for `cargo run` .

:Ctest <args>                                                       *:Ctest*
                Shortcut for `cargo test` .

:Cupdate <args>                                                   *:Cupdate*
                Shortcut for `cargo update` .

:Cbench <args>                                                     *:Cbench*
                Shortcut for `cargo bench` .

:Csearch <args>                                                   *:Csearch*
                Shortcut for `cargo search` .

:Cpublish <args>                                                 *:Cpublish*
                Shortcut for `cargo publish` .

:Cinstall <args>                                                 *:Cinstall*
                Shortcut for `cargo install` .

:Cruntarget <args>                                                 *:Cruntarget*
                Shortcut for `cargo run --bin` or `cargo run --example`,
                depending on the currently open buffer.

Formatting ~

: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.


Playpen integration ~

: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/"

		|g:rust_clip_command| is the command to run to copy the
		playpen url to the clipboard of your system.


Evaluation of a single Rust file ~

NOTE: These commands are useful only when working with standalone Rust files,
which is usually not the case for common Rust development. If you wish to
building Rust crates from with Vim can should use Vim's make, Syntastic, or
functionality from other plugins.


: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

Title: Rust Vim Plugin: Cargo Commands, Formatting, Playpen Integration, and Single File Evaluation
Summary
This section details various Vim commands provided by the Rust plugin. It covers shortcuts for Cargo commands like `:Csearch`, `:Cpublish`, `:Cinstall`, and `:Cruntarget`. It also describes commands for formatting Rust code using `rustfmt` (`:RustFmt`, `:RustFmtRange`) and integrating with the Rust playpen (`:RustPlay`) for online code execution. Finally, it explains the `:RustRun` command for compiling and running single Rust files, which is useful for standalone Rust development.