diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-08-14 21:25:52 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-08-14 21:25:52 +0200 |
commit | 6aa57295cfbe8f21c15f0671e45fd53cf990d404 (patch) | |
tree | 21d5b91f8af47cf5cecea7b615cd84a65a108c30 /runtime/ftplugin | |
parent | bfb2bb16bc69441fa3ec13caacb2c94637a8a0ec (diff) |
Update runtime files
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r-- | runtime/ftplugin/chicken.vim | 1 | ||||
-rw-r--r-- | runtime/ftplugin/julia.vim | 92 | ||||
-rw-r--r-- | runtime/ftplugin/scdoc.vim | 26 | ||||
-rw-r--r-- | runtime/ftplugin/scheme.vim | 5 |
4 files changed, 122 insertions, 2 deletions
diff --git a/runtime/ftplugin/chicken.vim b/runtime/ftplugin/chicken.vim index 4dc1e57d0a..84d45bae1e 100644 --- a/runtime/ftplugin/chicken.vim +++ b/runtime/ftplugin/chicken.vim @@ -2,6 +2,7 @@ " Last Change: 2018-03-05 " Author: Evan Hanson <evhan@foldling.org> " Maintainer: Evan Hanson <evhan@foldling.org> +" Repository: https://git.foldling.org/vim-scheme.git " URL: https://foldling.org/vim/ftplugin/chicken.vim " Notes: These are supplemental settings, to be loaded after the core " Scheme ftplugin file (ftplugin/scheme.vim). Enable it by setting diff --git a/runtime/ftplugin/julia.vim b/runtime/ftplugin/julia.vim new file mode 100644 index 0000000000..b65cf99711 --- /dev/null +++ b/runtime/ftplugin/julia.vim @@ -0,0 +1,92 @@ +" Vim filetype plugin file +" Language: Julia +" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com> +" Homepage: https://github.com/JuliaEditorSupport/julia-vim +" Last Change: 2021 Aug 04 +" adapted from upstream 2021 Aug 4 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo-=C + +setlocal include=^\\s*\\%(reload\\\|include\\)\\> +setlocal suffixesadd=.jl +setlocal comments=:# +setlocal commentstring=#\ %s +setlocal cinoptions+=#1 +setlocal define=^\\s*macro\\> +setlocal fo-=t fo+=croql + +let b:julia_vim_loaded = 1 + +let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<" + \ . " define< fo< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< completefunc<" + \ . " | unlet! b:julia_vim_loaded" + +" MatchIt plugin support +if exists("loaded_matchit") + let b:match_ignorecase = 0 + + " note: begin_keywords must contain all blocks, in order + " for nested-structures-skipping to work properly + " note: 'mutable struct' and 'struct' are defined separately because + " using \? puts the cursor on 'struct' instead of 'mutable' for some reason + let b:julia_begin_keywords = '\%(\.\s*\|@\)\@<!\<\%(function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|let\|do\|\%(bare\)\?module\|quote\|if\|for\|while\|try\)\>' + " 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 . '\)\|' + \ . '\%(' . s:nomacro . b:julia_begin_keywords . '\)' + let b:julia_end_keywords = '\<end\>' + + " note: this function relies heavily on the syntax file + function! JuliaGetMatchWords() + let [l,c] = [line('.'),col('.')] + let attr = synIDattr(synID(l, c, 1),"name") + let c1 = c + while attr == 'juliaMacro' || expand('<cword>') =~# '\<\%(global\|local\)\>' + normal! W + if line('.') > l || col('.') == c1 + call cursor(l, c) + return '' + endif + let attr = synIDattr(synID(l, col('.'), 1),"name") + let c1 = col('.') + endwhile + call cursor(l, c) + if attr == 'juliaConditional' + return b:julia_begin_keywordsm . ':\<\%(elseif\|else\)\>:' . b:julia_end_keywords + elseif attr =~# '\<\%(juliaRepeat\|juliaRepKeyword\)\>' + return b:julia_begin_keywordsm . ':\<\%(break\|continue\)\>:' . b:julia_end_keywords + elseif attr == 'juliaBlKeyword' + return b:julia_begin_keywordsm . ':' . b:julia_end_keywords + elseif attr == 'juliaException' + return b:julia_begin_keywordsm . ':\<\%(catch\|finally\)\>:' . b:julia_end_keywords + endif + return '\<\>:\<\>' + endfunction + + let b:match_words = 'JuliaGetMatchWords()' + + " we need to skip everything within comments, strings and + " the 'begin' and 'end' keywords when they are used as a range rather than as + " the delimiter of a block + let b:match_skip = 'synIDattr(synID(line("."),col("."),0),"name") =~# ' + \ . '"\\<julia\\%(Comprehension\\%(For\\|If\\)\\|RangeKeyword\\|Comment\\%([LM]\\|Delim\\)\\|\\%([bs]\\|Shell\\|Printf\\|Doc\\)\\?String\\|StringPrefixed\\|DocStringM\\(Raw\\)\\?\\|RegEx\\|SymbolS\\?\\|Dotted\\)\\>"' + + let b:undo_ftplugin = b:undo_ftplugin + \ . " | unlet! b:match_words b:match_skip b:match_ignorecase" + \ . " | unlet! b:julia_begin_keywords b:julia_end_keywords" + \ . " | delfunction JuliaGetMatchWords" + +endif + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/ftplugin/scdoc.vim b/runtime/ftplugin/scdoc.vim new file mode 100644 index 0000000000..2e98e647f4 --- /dev/null +++ b/runtime/ftplugin/scdoc.vim @@ -0,0 +1,26 @@ +" scdoc filetype plugin +" Maintainer: Gregory Anders <greg@gpanders.com> +" Last Updated: 2021-08-04 + +" Only do this when not done yet for this buffer +if exists('b:did_ftplugin') + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +setlocal comments=b:; +setlocal commentstring=;%s +setlocal formatoptions+=t +setlocal noexpandtab +setlocal shiftwidth=0 +setlocal softtabstop=0 +setlocal textwidth=80 + +let b:undo_ftplugin = 'setl com< cms< fo< et< sw< sts< tw<' + +if has('conceal') + setlocal conceallevel=2 + let b:undo_ftplugin .= ' cole<' +endif diff --git a/runtime/ftplugin/scheme.vim b/runtime/ftplugin/scheme.vim index 5778594c41..04655bc136 100644 --- a/runtime/ftplugin/scheme.vim +++ b/runtime/ftplugin/scheme.vim @@ -1,9 +1,10 @@ " Vim filetype plugin file " Language: Scheme (R7RS) -" Last Change: 2019 Nov 18 +" Last Change: 2019-11-19 " Author: Evan Hanson <evhan@foldling.org> " Maintainer: Evan Hanson <evhan@foldling.org> " Previous Maintainer: Sergey Khorev <sergey.khorev@gmail.com> +" Repository: https://git.foldling.org/vim-scheme.git " URL: https://foldling.org/vim/ftplugin/scheme.vim if exists('b:did_ftplugin') @@ -48,7 +49,7 @@ let b:undo_ftplugin = b:undo_ftplugin . ' lispwords<' let b:did_scheme_ftplugin = 1 if exists('b:is_chicken') || exists('g:is_chicken') - exe 'ru! ftplugin/chicken.vim' + runtime! ftplugin/chicken.vim endif unlet b:did_scheme_ftplugin |