about summary refs log tree commit diff
path: root/src/etc/vim/ftplugin/rust.vim
diff options
context:
space:
mode:
authorChris Morgan <me@chrismorgan.info>2013-07-10 01:30:32 +1000
committerChris Morgan <me@chrismorgan.info>2013-07-10 01:30:32 +1000
commitcf65870962ebf6b9b115a8f38ca7a9acc4bbfc49 (patch)
treeb32d7f336c82ccf5fad851546d0b7e9030d22f9c /src/etc/vim/ftplugin/rust.vim
parent3fa4cef876714db93ba64b8e1166f21775f99a29 (diff)
downloadrust-cf65870962ebf6b9b115a8f38ca7a9acc4bbfc49.tar.gz
rust-cf65870962ebf6b9b115a8f38ca7a9acc4bbfc49.zip
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.
Diffstat (limited to 'src/etc/vim/ftplugin/rust.vim')
-rw-r--r--src/etc/vim/ftplugin/rust.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/etc/vim/ftplugin/rust.vim b/src/etc/vim/ftplugin/rust.vim
new file mode 100644
index 00000000000..f329dd6ce02
--- /dev/null
+++ b/src/etc/vim/ftplugin/rust.vim
@@ -0,0 +1,25 @@
+" Vim syntax file
+" Language:     Rust
+" Maintainer:   Chris Morgan <me@chrismorgan.info>
+" Last Change:  2013 Jul 6
+
+if exists("b:did_ftplugin")
+	finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=s1:/*,mb:*,ex:*/,:///,://!,://
+setlocal commentstring=//%s
+setlocal formatoptions-=t formatoptions+=croqnlj
+
+" This includeexpr isn't perfect, but it's a good start
+setlocal includeexpr=substitute(v:fname,'::','/','g')
+
+" NOT adding .rc as it's being phased out (0.7)
+setlocal suffixesadd=.rs
+
+if exists("g:ftplugin_rust_source_path")
+    let &l:path=g:ftplugin_rust_source_path . ',' . &l:path
+endif
+
+let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd<"