diff options
Diffstat (limited to 'ftplugin/julia.vim')
-rw-r--r-- | ftplugin/julia.vim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ftplugin/julia.vim b/ftplugin/julia.vim index caddabaf..bed55a8f 100644 --- a/ftplugin/julia.vim +++ b/ftplugin/julia.vim @@ -34,7 +34,10 @@ if exists("loaded_matchit") " note: begin_keywords must contain all blocks in order " for nested-structures-skipping to work properly let b:julia_begin_keywords = '\%(\%(\.\s*\)\@<!\|\%(@\s*.\s*\)\@<=\)\<\%(\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|\%(\(abstract\|primitive\)\s\+\)\@<!type\|immutable\|let\|do\|\%(bare\)\?module\|quote\|if\|for\|while\|try\)\>' - let s:macro_regex = '@\%(#\@!\S\)\+\s\+' + " note: the following regex not only recognizes macros, but also local/global keywords. + " the purpose is recognizing things like `@inline myfunction()` + " or `global myfunction(...)` etc, for matchit and block movement functionality + let s:macro_regex = '\%(@\%(#\@!\S\)\+\|\<\%(local\|global\)\)\s\+' let s:nomacro = '\%(' . s:macro_regex . '\)\@<!' let s:yesmacro = s:nomacro . '\%('. s:macro_regex . '\)\+' let b:julia_begin_keywordsm = '\%(' . s:yesmacro . b:julia_begin_keywords . '\)\|' @@ -46,7 +49,7 @@ if exists("loaded_matchit") let [l,c] = [line('.'),col('.')] let attr = synIDattr(synID(l, c, 1),"name") let c1 = c - while attr == 'juliaMacro' + while attr == 'juliaMacro' || expand('<cword>') =~# '\<\%(global\|local\)\>' normal! W if line('.') > l || col('.') == c1 call cursor(l, c) |