|
2 | 2 | " Description: Vim syntax file for Rust
|
3 | 3 | " Maintainer: Chris Morgan <[email protected]>
|
4 | 4 | " Maintainer: Kevin Ballard <[email protected]>
|
5 |
| -" Last Change: May 27, 2014 |
| 5 | +" Last Change: July 06, 2014 |
6 | 6 |
|
7 | 7 | if exists("b:did_ftplugin")
|
8 | 8 | finish
|
@@ -35,7 +35,24 @@ silent! setlocal formatoptions+=j
|
35 | 35 | " otherwise it's better than nothing.
|
36 | 36 | setlocal smartindent nocindent
|
37 | 37 |
|
38 |
| -setlocal tabstop=4 shiftwidth=4 expandtab |
| 38 | +setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab |
| 39 | + |
| 40 | +" Line lengths {{{2 |
| 41 | + |
| 42 | +" Rust style conventions for line lengths say you SHOULD not go over 80 |
| 43 | +" columns and MUST not go over 100. |
| 44 | +" Without a good 'formatexpr' we can't automatically wrap code, but we can |
| 45 | +" still wrap comments just fine with 'textwidth'. |
| 46 | +setlocal textwidth=80 |
| 47 | + |
| 48 | +" We can also use 'colorcolumn' to highlight both the 80 and 100 limits. Not |
| 49 | +" everyone likes this so it's gated. |
| 50 | +if exists('g:rust_colorcolumn') |
| 51 | + setlocal colorcolumn=+1,101 |
| 52 | + let b:rust_colorcolumn=1 |
| 53 | +endif |
| 54 | + |
| 55 | +" }}}2 |
39 | 56 |
|
40 | 57 | " This includeexpr isn't perfect, but it's a good start
|
41 | 58 | setlocal includeexpr=substitute(v:fname,'::','/','g')
|
@@ -93,7 +110,12 @@ endif
|
93 | 110 | " Cleanup {{{1
|
94 | 111 |
|
95 | 112 | let b:undo_ftplugin = "
|
96 |
| - \setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< |
| 113 | + \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< |
| 114 | + \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< |
| 115 | + \|if exists('b:rust_colorcolumn') |
| 116 | + \|setlocal colorcolumn< |
| 117 | + \|unlet b:rust_colorcolumn |
| 118 | + \|endif |
97 | 119 | \|if exists('b:rust_original_delimitMate_excluded_regions')
|
98 | 120 | \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions
|
99 | 121 | \|unlet b:rust_original_delimitMate_excluded_regions
|
|
0 commit comments