Mercurial > vim
annotate runtime/ftplugin/rust.vim @ 33255:555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Commit: https://github.com/vim/vim/commit/fc93594d562dbbd9da03c89754538f91efd0c7ca
Author: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Date: Tue Sep 12 13:23:38 2023 -0500
runtime(rust): sync rust runtime files with upstream (https://github.com/vim/vim/issues/13075)
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 12 Sep 2023 20:30:07 +0200 |
parents | ef1c4fa8fc11 |
children | 99c2ceb9dbea |
rev | line source |
---|---|
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Language: Rust |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " Description: Vim ftplugin for Rust |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " Maintainer: Chris Morgan <me@chrismorgan.info> |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
4 " Last Change: 2023-09-11 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
5 " For bugs, patches and license go to https://github.com/rust-lang/rust.vim |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 if exists("b:did_ftplugin") |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
8 finish |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 endif |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 let b:did_ftplugin = 1 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
12 " vint: -ProhibitAbbreviationOption |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 let s:save_cpo = &cpo |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 set cpo&vim |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
15 " vint: +ProhibitAbbreviationOption |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
17 if get(b:, 'current_compiler', '') ==# '' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
18 if strlen(findfile('Cargo.toml', '.;')) > 0 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
19 compiler cargo |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
20 else |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
21 compiler rustc |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
22 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
23 endif |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " Variables {{{1 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " The rust source code at present seems to typically omit a leader on /*! |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 " comments, so we'll use that as our default, but make it easy to switch. |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 " This does not affect indentation at all (I tested it with and without |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 " leader), merely whether a leader is inserted by default or not. |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
31 if get(g:, 'rust_bang_comment_leader', 0) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
32 " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
33 " but without it, */ gets indented one space even if there were no |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
34 " leaders. I'm fairly sure that's a Vim bug. |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
35 setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,:// |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 else |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
37 setlocal comments=s0:/*!,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,:// |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 endif |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 setlocal commentstring=//%s |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 setlocal formatoptions-=t formatoptions+=croqnl |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 " j was only added in 7.3.541, so stop complaints about its nonexistence |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 silent! setlocal formatoptions+=j |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 " smartindent will be overridden by indentexpr if filetype indent is on, but |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 " otherwise it's better than nothing. |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 setlocal smartindent nocindent |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
48 if get(g:, 'rust_recommended_style', 1) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
49 let b:rust_set_style = 1 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
50 setlocal shiftwidth=4 softtabstop=4 expandtab |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
51 setlocal textwidth=99 |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 endif |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
54 setlocal include=\\v^\\s*(pub\\s+)?use\\s+\\zs(\\f\|:)+ |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
55 setlocal includeexpr=rust#IncludeExpr(v:fname) |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 setlocal suffixesadd=.rs |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 if exists("g:ftplugin_rust_source_path") |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 let &l:path=g:ftplugin_rust_source_path . ',' . &l:path |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 endif |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 if exists("g:loaded_delimitMate") |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
64 if exists("b:delimitMate_excluded_regions") |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
65 let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
66 endif |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
68 augroup rust.vim.DelimitMate |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
69 autocmd! |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
71 autocmd User delimitMate_map :call rust#delimitmate#onMap() |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
72 autocmd User delimitMate_unmap :call rust#delimitmate#onUnmap() |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
73 augroup END |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 endif |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
76 " Integration with auto-pairs (https://github.com/jiangmiao/auto-pairs) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
77 if exists("g:AutoPairsLoaded") && !get(g:, 'rust_keep_autopairs_default', 0) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
78 let b:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', '`':'`'} |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 endif |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
81 if has("folding") && get(g:, 'rust_fold', 0) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
82 let b:rust_set_foldmethod=1 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
83 setlocal foldmethod=syntax |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
84 if g:rust_fold == 2 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
85 setlocal foldlevel< |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
86 else |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
87 setlocal foldlevel=99 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
88 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
89 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
90 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
91 if has('conceal') && get(g:, 'rust_conceal', 0) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
92 let b:rust_set_conceallevel=1 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
93 setlocal conceallevel=2 |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 endif |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 " Motion Commands {{{1 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 " Bind motion commands to support hanging indents |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 nnoremap <silent> <buffer> [[ :call rust#Jump('n', 'Back')<CR> |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 nnoremap <silent> <buffer> ]] :call rust#Jump('n', 'Forward')<CR> |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 xnoremap <silent> <buffer> [[ :call rust#Jump('v', 'Back')<CR> |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR> |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR> |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR> |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 " Commands {{{1 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 " See |:RustRun| for docs |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(<bang>0, <q-args>) |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 " See |:RustExpand| for docs |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(<bang>0, <q-args>) |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 " See |:RustEmitIr| for docs |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", <q-args>) |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 " See |:RustEmitAsm| for docs |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>) |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 " See |:RustPlay| for docs |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
121 command! -range=% -buffer RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>) |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 " See |:RustFmt| for docs |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
124 command! -bar -buffer RustFmt call rustfmt#Format() |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 " See |:RustFmtRange| for docs |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>) |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
129 " See |:RustInfo| for docs |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
130 command! -bar -buffer RustInfo call rust#debugging#Info() |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
131 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
132 " See |:RustInfoToClipboard| for docs |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
133 command! -bar -buffer RustInfoToClipboard call rust#debugging#InfoToClipboard() |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
135 " See |:RustInfoToFile| for docs |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
136 command! -bar -nargs=1 -buffer RustInfoToFile call rust#debugging#InfoToFile(<f-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
137 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
138 " See |:RustTest| for docs |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
139 command! -buffer -nargs=* -count -bang RustTest call rust#Test(<q-mods>, <count>, <bang>0, <q-args>) |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
142 let b:rust_last_rustc_args = [] |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
143 let b:rust_last_args = [] |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 endif |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 " Cleanup {{{1 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 let b:undo_ftplugin = " |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
149 \ setlocal formatoptions< comments< commentstring< include< includeexpr< suffixesadd< |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
150 \|if exists('b:rust_set_style') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
151 \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
152 \|endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
153 \|if exists('b:rust_original_delimitMate_excluded_regions') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
154 \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
155 \|unlet b:rust_original_delimitMate_excluded_regions |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
156 \|else |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
157 \|unlet! b:delimitMate_excluded_regions |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
158 \|endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
159 \|if exists('b:rust_set_foldmethod') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
160 \|setlocal foldmethod< foldlevel< |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
161 \|unlet b:rust_set_foldmethod |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
162 \|endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
163 \|if exists('b:rust_set_conceallevel') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
164 \|setlocal conceallevel< |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
165 \|unlet b:rust_set_conceallevel |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
166 \|endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
167 \|unlet! b:rust_last_rustc_args b:rust_last_args |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
168 \|delcommand -buffer RustRun |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
169 \|delcommand -buffer RustExpand |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
170 \|delcommand -buffer RustEmitIr |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
171 \|delcommand -buffer RustEmitAsm |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
172 \|delcommand -buffer RustPlay |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
173 \|delcommand -buffer RustFmt |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
174 \|delcommand -buffer RustFmtRange |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
175 \|delcommand -buffer RustInfo |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
176 \|delcommand -buffer RustInfoToClipboard |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
177 \|delcommand -buffer RustInfoToFile |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
178 \|delcommand -buffer RustTest |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
179 \|nunmap <buffer> [[ |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
180 \|nunmap <buffer> ]] |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
181 \|xunmap <buffer> [[ |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
182 \|xunmap <buffer> ]] |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
183 \|ounmap <buffer> [[ |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
184 \|ounmap <buffer> ]] |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
185 \|setlocal matchpairs-=<:> |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
186 \|unlet b:match_skip |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
187 \" |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 " }}}1 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 " Code formatting on save |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
192 augroup rust.vim.PreWrite |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
193 autocmd! |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
194 autocmd BufWritePre *.rs silent! call rustfmt#PreWrite() |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 augroup END |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
197 setlocal matchpairs+=<:> |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
198 " For matchit.vim (rustArrow stops `Fn() -> X` messing things up) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
199 let b:match_skip = 's:comment\|string\|rustCharacter\|rustArrow' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
200 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
201 command! -buffer -nargs=+ Cargo call cargo#cmd(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
202 command! -buffer -nargs=* Cbuild call cargo#build(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
203 command! -buffer -nargs=* Ccheck call cargo#check(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
204 command! -buffer -nargs=* Cclean call cargo#clean(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
205 command! -buffer -nargs=* Cdoc call cargo#doc(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
206 command! -buffer -nargs=+ Cnew call cargo#new(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
207 command! -buffer -nargs=* Cinit call cargo#init(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
208 command! -buffer -nargs=* Crun call cargo#run(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
209 command! -buffer -nargs=* Ctest call cargo#test(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
210 command! -buffer -nargs=* Cbench call cargo#bench(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
211 command! -buffer -nargs=* Cupdate call cargo#update(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
212 command! -buffer -nargs=* Csearch call cargo#search(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
213 command! -buffer -nargs=* Cpublish call cargo#publish(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
214 command! -buffer -nargs=* Cinstall call cargo#install(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
215 command! -buffer -nargs=* Cruntarget call cargo#runtarget(<q-args>) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
216 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
217 let b:undo_ftplugin .= ' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
218 \|delcommand -buffer Cargo |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
219 \|delcommand -buffer Cbuild |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
220 \|delcommand -buffer Ccheck |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
221 \|delcommand -buffer Cclean |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
222 \|delcommand -buffer Cdoc |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
223 \|delcommand -buffer Cnew |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
224 \|delcommand -buffer Cinit |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
225 \|delcommand -buffer Crun |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
226 \|delcommand -buffer Ctest |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
227 \|delcommand -buffer Cbench |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
228 \|delcommand -buffer Cupdate |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
229 \|delcommand -buffer Csearch |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
230 \|delcommand -buffer Cpublish |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
231 \|delcommand -buffer Cinstall |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
232 \|delcommand -buffer Cruntarget' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
233 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
234 " vint: -ProhibitAbbreviationOption |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 let &cpo = s:save_cpo |
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 unlet s:save_cpo |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
237 " vint: +ProhibitAbbreviationOption |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 |
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
32726
diff
changeset
|
239 " vim: set et sw=4 sts=4 ts=8: |