Skip to content

vim improvements #5049

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 1 commit into from
Feb 21, 2013
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
5 changes: 5 additions & 0 deletions src/etc/vim/after/ftplugin/rust.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"Highlight the 78th text column
"Feature became available in v7.3
if version >= 703
set colorcolumn=78
Copy link
Member

Choose a reason for hiding this comment

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

👍. I have mine set to 80 everywhere, having it set to 78 for .rs files will be nice.

endif
6 changes: 5 additions & 1 deletion src/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
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