Skip to content

Commit cf65870

Browse files
committed
Add a Vim filetype plugin with useful tweaks.
This improves things like doc comment handling when you press Enter and making using `gf` or `<C-W>f` work on a `use x;` statement in the current directory.
1 parent 3fa4cef commit cf65870

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/etc/vim/ftplugin/rust.vim

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
" Vim syntax file
2+
" Language: Rust
3+
" Maintainer: Chris Morgan <[email protected]>
4+
" Last Change: 2013 Jul 6
5+
6+
if exists("b:did_ftplugin")
7+
finish
8+
endif
9+
let b:did_ftplugin = 1
10+
11+
setlocal comments=s1:/*,mb:*,ex:*/,:///,://!,://
12+
setlocal commentstring=//%s
13+
setlocal formatoptions-=t formatoptions+=croqnlj
14+
15+
" This includeexpr isn't perfect, but it's a good start
16+
setlocal includeexpr=substitute(v:fname,'::','/','g')
17+
18+
" NOT adding .rc as it's being phased out (0.7)
19+
setlocal suffixesadd=.rs
20+
21+
if exists("g:ftplugin_rust_source_path")
22+
let &l:path=g:ftplugin_rust_source_path . ',' . &l:path
23+
endif
24+
25+
let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd<"

0 commit comments

Comments
 (0)