Skip to content

A few more changes for Vim #15476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/etc/vim/doc/rust.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*rust.txt* Filetype plugin for Rust

==============================================================================
CONTENTS *rust*
CONTENTS *rust* *ft-rust*

1. Introduction |rust-intro|
2. Settings |rust-settings|
Expand Down Expand Up @@ -53,6 +53,18 @@ g:rust_conceal_pub~
let g:rust_conceal_pub = 1
<

*g:rust_fold*
g:rust_fold~
Set this option to turn on |folding|: >
let g:rust_fold = 1
<
Value Effect ~
0 No folding
1 Braced blocks are folded. All folds are open by
default.
2 Braced blocks are folded. 'foldlevel' is left at the
global value (all folds are closed by default).

*g:rust_bang_comment_leader*
g:rust_bang_comment_leader~
Set this option to 1 to preserve the leader on multi-line doc comments
Expand Down
9 changes: 6 additions & 3 deletions src/etc/vim/ftplugin/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
" Description: Vim syntax file for Rust
" Maintainer: Chris Morgan <[email protected]>
" Maintainer: Kevin Ballard <[email protected]>
" Last Change: May 27, 2014
" Last Change: Jul 07, 2014

if exists("b:did_ftplugin")
finish
Expand Down Expand Up @@ -35,7 +35,9 @@ silent! setlocal formatoptions+=j
" otherwise it's better than nothing.
setlocal smartindent nocindent

setlocal tabstop=4 shiftwidth=4 expandtab
setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab

setlocal textwidth=99

" This includeexpr isn't perfect, but it's a good start
setlocal includeexpr=substitute(v:fname,'::','/','g')
Expand Down Expand Up @@ -93,7 +95,8 @@ endif
" Cleanup {{{1

let b:undo_ftplugin = "
\setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd<
\ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd<
\|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth<
\|if exists('b:rust_original_delimitMate_excluded_regions')
\|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions
\|unlet b:rust_original_delimitMate_excluded_regions
Expand Down
15 changes: 12 additions & 3 deletions src/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@
" Maintainer: Patrick Walton <[email protected]>
" Maintainer: Ben Blum <[email protected]>
" Maintainer: Chris Morgan <[email protected]>
" Last Change: 2014 Feb 27
" Last Change: July 06, 2014

if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif

" Fold settings {{{1

if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
setlocal foldmethod=syntax
if g:rust_fold == 2
setlocal foldlevel<
else
setlocal foldlevel=99
endif
endif

" Syntax definitions {{{1
" Basic keywords {{{2
syn keyword rustConditional match if else
Expand Down Expand Up @@ -213,8 +224,6 @@ syn keyword rustTodo contained TODO FIXME XXX NB NOTE
" Trivial folding rules to begin with.
" TODO: use the AST to make really good folding
syn region rustFoldBraces start="{" end="}" transparent fold
" If you wish to enable this, setlocal foldmethod=syntax
" It's not enabled by default as it would drive some people mad.

" Default highlighting {{{1
hi def link rustDecNumber rustNumber
Expand Down