From 78cca45790e1dacac4a520a13b55855aecf1eaa2 Mon Sep 17 00:00:00 2001 From: Gab-km Date: Fri, 29 Dec 2017 10:22:47 +0900 Subject: [PATCH 1/2] Enable `Using` and `With` syntaxes * Add `With` syntax and indent * Modify `Using` syntax with replacing from `match` to `keyword` * Make `Call` deprecated and `ByRef` not deprecated * Update header comments --- indent/vbnet.vim | 9 +++++---- syntax/vbnet.vim | 13 ++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/indent/vbnet.vim b/indent/vbnet.vim index d83cff3..2d84469 100644 --- a/indent/vbnet.vim +++ b/indent/vbnet.vim @@ -1,7 +1,7 @@ " Vim indent file " Language : VisualBasic.NET -" Maintainers: OGURA Daiki -" Last Change: 2013-01-25 +" Maintainers: OGURA Daiki, MATSUSHIMA Kazuhiro +" Last Change: 2017-12-27 if exists("b:did_indent") finish @@ -45,7 +45,7 @@ function VbNetGetIndent(lnum) if previous_line =~? 'Then$' return ind + &l:shiftwidth - elseif previous_line =~? '^\s*\<\(Select Case\|Else\|ElseIf\|For\|While\|Using\|Try\|Catch\|Finally\)\>' + elseif previous_line =~? '^\s*\<\(Select Case\|Else\|ElseIf\|For\|While\|Using\|With\|Try\|Catch\|Finally\)\>' return ind + &l:shiftwidth elseif previous_line =~? '^\s\+}$' return &l:shiftwidth + &l:shiftwidth @@ -53,7 +53,8 @@ function VbNetGetIndent(lnum) if previous_line =~? 'End \(If\|Case\|Try\|Sub\|Function\|Class\|Operator\)$' return ind - + elseif previous_line =~? 'End \(Select\|While\|Using\|With\|Try\)$' + return ind endif " labels and preprocessor get zero indent immediately diff --git a/syntax/vbnet.vim b/syntax/vbnet.vim index a18eb48..f92c590 100644 --- a/syntax/vbnet.vim +++ b/syntax/vbnet.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language : VisualBasic.NET -" Maintainers: OGURA Daiki -" Last Change: 2013-01-25 +" Maintainers: OGURA Daiki, MATSUSHIMA Kazuhiro +" Last Change: 2017-12-29 if version < 600 syntax clear @@ -57,15 +57,17 @@ syn match vbnetDefAnonymousTypedef "=\s\ \(With$\|With {$\)" syn keyword vbnetProperty Property Get Set syn match vbnetPropertyEnd "^\s*End \(Get\|Set\|Property\)$" -syn keyword vbnetKeyword ByVal GetType ParamArray On Option Optional Exit Imports +syn keyword vbnetKeyword ByVal ByRef GetType ParamArray On Option Optional Exit Imports syn keyword vbnetException Try Catch Finally Throw syn match vbnetException "\ Try$" -syn match vbnetUsing Using +syn keyword vbnetUsing Using syn match vbnetUsing "\ Using$" +syn keyword vbnetWith With +syn match vbnetWith "\ With$" syn keyword vbnetOperator New And Or AndAlso OrElse Is Not IsNot Like Mod syn keyword vbnetBoolean True False syn match vbnetDelimiter "\(,\|\.\|:\|{\|}\|\s_$\)" -syn keyword vbnetDeprecated Do Until Loop Goto Redim GoSub Resume Erase Preserve IIF ByRef +syn keyword vbnetDeprecated Do Until Loop Goto Redim GoSub Resume Erase Preserve IIF Call "}}} syn keyword vbnetConst MyBase MyClass Me Nothing @@ -133,6 +135,7 @@ if version >= 508 || !exists("did_vbnet") hi link vbnetKeyword Keyword hi link vbnetException Exception hi link vbnetUsing Exception + hi link vbnetWith Conditional hi link vbnetAttribute PreProc hi link vbnetStorage StorageClass hi link vbnetModifier vbnetStorage From 109e19723200163e9cdc94b60d6da533271cce36 Mon Sep 17 00:00:00 2001 From: Gab-km Date: Fri, 29 Dec 2017 10:29:06 +0900 Subject: [PATCH 2/2] Merge indent rules --- indent/vbnet.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/indent/vbnet.vim b/indent/vbnet.vim index 2d84469..3e88cb1 100644 --- a/indent/vbnet.vim +++ b/indent/vbnet.vim @@ -51,9 +51,7 @@ function VbNetGetIndent(lnum) return &l:shiftwidth + &l:shiftwidth endif - if previous_line =~? 'End \(If\|Case\|Try\|Sub\|Function\|Class\|Operator\)$' - return ind - elseif previous_line =~? 'End \(Select\|While\|Using\|With\|Try\)$' + if previous_line =~? 'End \(If\|Case\|While\|Using\|With\|Try\|Sub\|Function\|Class\|Operator\)$' return ind endif