From: Kevin Ballard Date: Fri, 30 May 2014 07:06:52 +0000 (-0700) Subject: Write documentation for the Rust vim plugin X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=918eda59bee9a627919d11b7bc9f909d7a9676ff;p=rust.git Write documentation for the Rust vim plugin --- diff --git a/src/etc/vim/doc/rust.txt b/src/etc/vim/doc/rust.txt new file mode 100644 index 00000000000..e0a647225a9 --- /dev/null +++ b/src/etc/vim/doc/rust.txt @@ -0,0 +1,129 @@ +*rust.txt* Filetype plugin for Rust + +============================================================================== +CONTENTS *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_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' +< + +============================================================================== +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. + + +============================================================================== +MAPPINGS *rust-mappings* + +This plugin defines mappings for |[[| and |]]| to support hanging indents. + +It also has a few other mappings: + + *rust_* + Executes |:RustRun| with no arguments. + Note: This binding is only available in MacVim. + + *rust_* + 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: diff --git a/src/etc/vim/ftplugin/rust.vim b/src/etc/vim/ftplugin/rust.vim index 6e373b2ddc4..ed5d721de08 100644 --- a/src/etc/vim/ftplugin/rust.vim +++ b/src/etc/vim/ftplugin/rust.vim @@ -60,33 +60,10 @@ onoremap ]] :call rust#Jump('o', 'Forward') " Commands {{{1 -" :RustRun will compile and run the current file. If it has unsaved changes, -" they will be saved first. If it has no path, it will be written to a -" temporary file first. The generated binary is always placed in a temporary -" directory, but run from the current directory. -" -" The arguments passed to :RustRun will be passed to the generated binary. -" -" If ! is specified, the arguments are given to rustc as well. A -- argument -" separates rustc args from the args passed to the binary. -" -" If g:rustc_path is defined, it is used as the path to rustc. Otherwise it is -" assumed that rustc is in $PATH. +" See |:RustRun| for docs command! -nargs=* -complete=file -bang -bar -buffer RustRun call rust#Run(0, []) -" :RustExpand will expand the current file using --pretty. -" -" Any arguments given to :RustExpand will be passed to rustc. This is largely -" so you can pass various --cfg configurations. -" -" If ! is specified, the first argument will be interpreted as the --pretty -" type. Otherwise it will default to 'expanded'. -" -" If the current file has unsaved changes, it will be saved first. If it's an -" unnamed buffer, it will be written to a temporary file. -" -" If g:rustc_path is defined, it is used as the path to rustc. Otherwise it is -" assumed that rustc is in $PATH. +" See |:RustExpand| for docs command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -bar -buffer RustExpand call rust#Expand(0, []) " Mappings {{{1