Skip to content

Commit

Permalink
vim improvements
Browse files Browse the repository at this point in the history
1. Highlight new lifetime syntax
2. Visually distinguish `unsafe` keyword
3. Add a new file that highlights column 78, to warn when lines get too long
  • Loading branch information
bstrie committed Feb 20, 2013
1 parent b88e4f3 commit e29b7ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/etc/vim/after/ftplugin/rust.vim
@@ -0,0 +1,5 @@
"Highlight the 78th text column
"Feature became available in v7.3
if version >= 703
set colorcolumn=78
endif
6 changes: 5 additions & 1 deletion src/etc/vim/syntax/rust.vim
Expand Up @@ -103,12 +103,15 @@ syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\(f\|f32\|f64\)\>
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\>"
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"

"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
syn match rustCharacter "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'"

syn region rustComment start="/\*" end="\*/" contains=rustComment,rustTodo
syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo keepend

syn keyword rustTodo TODO FIXME XXX NB

syn keyword rustTodo TODO FIXME XXX NB unsafe

hi def link rustHexNumber rustNumber
hi def link rustBinNumber rustNumber
Expand All @@ -134,6 +137,7 @@ hi def link rustType Type
hi def link rustTodo Todo
hi def link rustAttribute PreProc
hi def link rustStorage StorageClass
hi def link rustLifetime Special

" Other Suggestions:
" hi rustAssert ctermfg=yellow
Expand Down

5 comments on commit e29b7ee

@bors
Copy link
Contributor

@bors bors commented on e29b7ee Feb 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from catamorphism
at bstrie@e29b7ee

@bors
Copy link
Contributor

@bors bors commented on e29b7ee Feb 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging bstrie/rust/vim = e29b7ee into auto

@bors
Copy link
Contributor

@bors bors commented on e29b7ee Feb 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bstrie/rust/vim = e29b7ee merged ok, testing candidate = 1b04be6

@bors
Copy link
Contributor

@bors bors commented on e29b7ee Feb 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on e29b7ee Feb 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = 1b04be6

Please sign in to comment.