mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 15:19:12 +08:00
feat(plantuml): fix lang#plantuml
layer
close https://github.com/SpaceVim/SpaceVim/issues/4804
This commit is contained in:
parent
7e370e7c65
commit
9a33b7f001
@ -43,8 +43,8 @@
|
||||
|
||||
function! SpaceVim#layers#lang#plantuml#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, ['aklt/plantuml-syntax', {'on_ft' : 'plantuml'}])
|
||||
call add(plugins, ['wsdjeg/vim-slumlord', {'on_ft' : 'plantuml'}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/plantuml-syntax', {'merged' : 0}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-slumlord', {'on_ft' : 'plantuml'}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/plantuml-previewer.vim', {'merged':0}])
|
||||
return plugins
|
||||
endfunction
|
||||
|
7
bundle/README.md
vendored
7
bundle/README.md
vendored
@ -14,6 +14,7 @@ In `bundle/` directory, there are two kinds of plugins: forked plugins without c
|
||||
- [`tmux` layer](#tmux-layer)
|
||||
- [`incsearch` layer](#incsearch-layer)
|
||||
- [`lang#java` layer](#langjava-layer)
|
||||
- [`lang#plantuml` layer](#langplantuml-layer)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
@ -91,3 +92,9 @@ This plugins are changed based on a specific version of origin plugin.
|
||||
#### `lang#java` layer
|
||||
|
||||
- `vim-javacomplete2` based on `https://github.com/artur-shaik/vim-javacomplete2/tree/a716e32bbe36daaed6ebc9aae76525aad9536245`
|
||||
|
||||
#### `lang#plantuml` layer
|
||||
|
||||
- [`scrooloose/vim-slumlord@5c34739`](https://github.com/scrooloose/vim-slumlord/tree/5c34739a6ca71ef3617ed71491b3387bb2fb5620)
|
||||
- [`aklt/plantuml-syntax@845abb5`](https://github.com/aklt/plantuml-syntax/tree/845abb56dcd3f12afa6eb47684ef5ba3055802b8)
|
||||
- [`weirongxu/plantuml-previewer.vim`](https://github.com/weirongxu/plantuml-previewer.vim)
|
||||
|
78
bundle/plantuml-syntax/LICENSE
vendored
Normal file
78
bundle/plantuml-syntax/LICENSE
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
VIM LICENSE
|
||||
|
||||
I) There are no restrictions on distributing unmodified copies of Vim except
|
||||
that they must include this license text. You can also distribute
|
||||
unmodified parts of Vim, likewise unrestricted except that they must
|
||||
include this license text. You are also allowed to include executables
|
||||
that you made from the unmodified Vim sources, plus your own usage
|
||||
examples and Vim scripts.
|
||||
|
||||
II) It is allowed to distribute a modified (or extended) version of Vim,
|
||||
including executables and/or source code, when the following four
|
||||
conditions are met:
|
||||
1) This license text must be included unmodified.
|
||||
2) The modified Vim must be distributed in one of the following five ways:
|
||||
a) If you make changes to Vim yourself, you must clearly describe in
|
||||
the distribution how to contact you. When the maintainer asks you
|
||||
(in any way) for a copy of the modified Vim you distributed, you
|
||||
must make your changes, including source code, available to the
|
||||
maintainer without fee. The maintainer reserves the right to
|
||||
include your changes in the official version of Vim. What the
|
||||
maintainer will do with your changes and under what license they
|
||||
will be distributed is negotiable. If there has been no negotiation
|
||||
then this license, or a later version, also applies to your changes.
|
||||
The current maintainer is Bram Moolenaar <Bram@vim.org>. If this
|
||||
changes it will be announced in appropriate places (most likely
|
||||
vim.sf.net, www.vim.org and/or comp.editors). When it is completely
|
||||
impossible to contact the maintainer, the obligation to send him
|
||||
your changes ceases. Once the maintainer has confirmed that he has
|
||||
received your changes they will not have to be sent again.
|
||||
b) If you have received a modified Vim that was distributed as
|
||||
mentioned under a) you are allowed to further distribute it
|
||||
unmodified, as mentioned at I). If you make additional changes the
|
||||
text under a) applies to those changes.
|
||||
c) Provide all the changes, including source code, with every copy of
|
||||
the modified Vim you distribute. This may be done in the form of a
|
||||
context diff. You can choose what license to use for new code you
|
||||
add. The changes and their license must not restrict others from
|
||||
making their own changes to the official version of Vim.
|
||||
d) When you have a modified Vim which includes changes as mentioned
|
||||
under c), you can distribute it without the source code for the
|
||||
changes if the following three conditions are met:
|
||||
- The license that applies to the changes permits you to distribute
|
||||
the changes to the Vim maintainer without fee or restriction, and
|
||||
permits the Vim maintainer to include the changes in the official
|
||||
version of Vim without fee or restriction.
|
||||
- You keep the changes for at least three years after last
|
||||
distributing the corresponding modified Vim. When the maintainer
|
||||
or someone who you distributed the modified Vim to asks you (in
|
||||
any way) for the changes within this period, you must make them
|
||||
available to him.
|
||||
- You clearly describe in the distribution how to contact you. This
|
||||
contact information must remain valid for at least three years
|
||||
after last distributing the corresponding modified Vim, or as long
|
||||
as possible.
|
||||
e) When the GNU General Public License (GPL) applies to the changes,
|
||||
you can distribute the modified Vim under the GNU GPL version 2 or
|
||||
any later version.
|
||||
3) A message must be added, at least in the output of the ":version"
|
||||
command and in the intro screen, such that the user of the modified Vim
|
||||
is able to see that it was modified. When distributing as mentioned
|
||||
under 2)e) adding the message is only required for as far as this does
|
||||
not conflict with the license used for the changes.
|
||||
4) The contact information as required under 2)a) and 2)d) must not be
|
||||
removed or changed, except that the person himself can make
|
||||
corrections.
|
||||
|
||||
III) If you distribute a modified version of Vim, you are encouraged to use
|
||||
the Vim license for your changes and make them available to the
|
||||
maintainer, including the source code. The preferred way to do this is
|
||||
by e-mail or by uploading the files to a server and e-mailing the URL.
|
||||
If the number of changes is small (e.g., a modified Makefile) e-mailing a
|
||||
context diff will do. The e-mail address to be used is
|
||||
<maintainer@vim.org>
|
||||
|
||||
IV) It is not allowed to remove this license from the distribution of the Vim
|
||||
sources, parts of it or from a modified version. You may use this
|
||||
license for previous Vim releases instead of the license that they came
|
||||
with, at your option.
|
19
bundle/plantuml-syntax/README.md
vendored
Normal file
19
bundle/plantuml-syntax/README.md
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# Vim PlantUML Syntax/Plugin/FTDetect
|
||||
|
||||
This is a vim syntax file for [PlantUML](http://plantuml.com).
|
||||
|
||||
The `filetype` will be set to `plantuml` for `*.pu`, `*.uml`, `*.puml`, `*.iuml` or
|
||||
`*.plantuml` files or if the first line of a file contains `@startuml`.
|
||||
|
||||
Additionally the `makeprg` is set to `plantuml` assuming you have this
|
||||
executable in your path. This file could contain something like
|
||||
|
||||
````sh
|
||||
#!/bin/bash
|
||||
java -jar $HOME/lib/java/plantuml.jar -tsvg $@
|
||||
````
|
||||
|
||||
You can change the name of this file by setting `g:plantuml_executable_script`
|
||||
and disable this feature by setting `g:plantuml_set_makeprg` to `0`.
|
||||
|
||||
See examples here: [Plantuml Syntax](https://aklt.github.io/plantuml/).
|
7
bundle/plantuml-syntax/ftdetect/plantuml.vim
vendored
Normal file
7
bundle/plantuml-syntax/ftdetect/plantuml.vim
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
" Vim filetype detection file
|
||||
" Language: PlantUML
|
||||
" License: VIM LICENSE
|
||||
|
||||
" Note: should not use augroup in ftdetect (see :help ftdetect)
|
||||
autocmd BufRead,BufNewFile * if !did_filetype() && getline(1) =~# '@startuml\>'| setfiletype plantuml | endif
|
||||
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml,*.puml,*.iuml set filetype=plantuml
|
42
bundle/plantuml-syntax/ftplugin/plantuml.vim
vendored
Normal file
42
bundle/plantuml-syntax/ftplugin/plantuml.vim
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: PlantUML
|
||||
" License: VIM LICENSE
|
||||
|
||||
if exists('b:loaded_plantuml_plugin')
|
||||
finish
|
||||
endif
|
||||
let b:loaded_plantuml_plugin = 1
|
||||
let s:cpo_save = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
if !exists('g:plantuml_executable_script')
|
||||
let g:plantuml_executable_script='plantuml'
|
||||
endif
|
||||
|
||||
if exists('loaded_matchit')
|
||||
let b:match_ignorecase = 0
|
||||
let b:match_words =
|
||||
\ '\(\<ref\>\|\<box\>\|\<opt\>\|\<alt\>\|\<group\>\|\<loop\>\|\<note\>\|\<legend\>\):\<else\>:\<end\>' .
|
||||
\ ',\<if\>:\<elseif\>:\<else\>:\<endif\>' .
|
||||
\ ',\<rnote\>:\<endrnote\>' .
|
||||
\ ',\<hnote\>:\<endhnote\>' .
|
||||
\ ',\<title\>:\<endtitle\>' .
|
||||
\ ',\<\while\>:\<endwhile\>' .
|
||||
\ ',@startuml:@enduml' .
|
||||
\ ',@startwbs:@endwbs' .
|
||||
\ ',@startmindmap:@endmindmap'
|
||||
endif
|
||||
|
||||
if get(g:, 'plantuml_set_makeprg', 1)
|
||||
let &l:makeprg=g:plantuml_executable_script . ' %'
|
||||
endif
|
||||
|
||||
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
|
||||
|
||||
let b:endwise_addition = '\=index(["dot","mindmap","uml","salt","wbs"], submatch(0))!=-1 ? "@end" . submatch(0) : index(["note","legend"], submatch(0))!=-1 ? "end " . submatch(0) : "end"'
|
||||
let b:endwise_words = 'loop,group,alt,note,legend,startdot,startmindmap,startuml,startsalt,startwbs'
|
||||
let b:endwise_pattern = '^\s*\zs\(loop\|group\|alt\|note\ze[^:]*$\|legend\|@start\zs\(dot\|mindmap\|uml\|salt\|wbs\)\)\>.*$'
|
||||
let b:endwise_syngroups = 'plantumlKeyword,plantumlPreProc'
|
||||
|
||||
let &cpoptions = s:cpo_save
|
||||
unlet s:cpo_save
|
83
bundle/plantuml-syntax/indent/plantuml.vim
vendored
Normal file
83
bundle/plantuml-syntax/indent/plantuml.vim
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
" Vim indent file
|
||||
" Language: PlantUML
|
||||
" License: VIM LICENSE
|
||||
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetPlantUMLIndent()
|
||||
setlocal indentkeys=o,O,<CR>,<:>,!^F,0end,0else,}
|
||||
|
||||
" only define the indent code once
|
||||
if exists('*GetPlantUMLIndent')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:decIndent = '^\s*\%(end\|else\|fork again\|}\)'
|
||||
|
||||
function! GetPlantUMLIndent(...) abort
|
||||
"for current line, use arg if given or v:lnum otherwise
|
||||
let clnum = a:0 ? a:1 : v:lnum
|
||||
|
||||
if !s:insidePlantUMLTags(clnum)
|
||||
return indent(clnum)
|
||||
endif
|
||||
|
||||
let pnum = prevnonblank(clnum-1)
|
||||
let pindent = indent(pnum)
|
||||
let pline = getline(pnum)
|
||||
let cline = getline(clnum)
|
||||
|
||||
let s:incIndent = s:getIncIndent()
|
||||
|
||||
if cline =~ s:decIndent
|
||||
if pline =~ s:incIndent
|
||||
return pindent
|
||||
else
|
||||
return pindent - shiftwidth()
|
||||
endif
|
||||
|
||||
elseif pline =~ s:incIndent
|
||||
return pindent + shiftwidth()
|
||||
endif
|
||||
|
||||
return pindent
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:insidePlantUMLTags(lnum) abort
|
||||
call cursor(a:lnum, 1)
|
||||
return search('@startuml', 'Wbn') && search('@enduml', 'Wn')
|
||||
endfunction
|
||||
|
||||
function! s:listSyntax(syntaxKeyword) abort
|
||||
" Get a list of words assigned to a syntax keyword
|
||||
" The 'syntax list <syntax keyword>' command returns
|
||||
" a string with the keyword itself, followed by xxx,
|
||||
" on which we can split to extract the keywords string.
|
||||
" This string must then be split on whitespace
|
||||
let syntaxWords = split(
|
||||
\ execute('syntax list ' . a:syntaxKeyword),
|
||||
\ a:syntaxKeyword . ' xxx ')[-1]
|
||||
return split(syntaxWords)
|
||||
endfunction
|
||||
|
||||
function! s:typeKeywordIncPattern() abort
|
||||
" Extract keywords for plantumlTypeKeyword, returning the inc pattern
|
||||
let syntaxWords = join(s:listSyntax('plantumlTypeKeyword'), '\\\|')
|
||||
return '^\s*\%(' . syntaxWords . '\)\>.*{'
|
||||
endfunction
|
||||
|
||||
function! s:getIncIndent() abort
|
||||
" Function to determine the s:incIndent pattern
|
||||
return
|
||||
\ '^\s*\%(artifact\|class\|cloud\|database\|entity\|enum\|file\|folder\|frame\|interface\|namespace\|node\|object\|package\|partition\|rectangle\|skinparam\|state\|storage\|together\)\>.*{\s*$\|' .
|
||||
\ '^\s*\%(loop\|alt\|opt\|group\|critical\|else\|legend\|box\|if\|while\|fork\|split\)\>\|' .
|
||||
\ '^\s*ref\>[^:]*$\|' .
|
||||
\ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' .
|
||||
\ '^\s*title\s*$\|' .
|
||||
\ '^\s*skinparam\>.*{\s*$\|' .
|
||||
\ s:typeKeywordIncPattern()
|
||||
endfunction
|
438
bundle/plantuml-syntax/syntax/plantuml.vim
vendored
Normal file
438
bundle/plantuml-syntax/syntax/plantuml.vim
vendored
Normal file
@ -0,0 +1,438 @@
|
||||
" Vim syntax file
|
||||
" Language: PlantUML
|
||||
" License: VIM LICENSE
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version < 600
|
||||
syntax clear
|
||||
endif
|
||||
|
||||
let s:cpo_orig=&cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
let b:current_syntax = 'plantuml'
|
||||
|
||||
syntax sync minlines=100
|
||||
|
||||
syntax match plantumlPreProc /\%(^@start\|^@end\)\%(board\|bpm\|creole\|cute\|def\|ditaa\|dot\|flow\|gantt\|git\|jcckit\|json\|latex\|math\|mindmap\|nwdiag\|project\|salt\|tree\|uml\|wbs\|wire\|yaml\)/
|
||||
syntax match plantumlPreProc /!\%(assert\|define\|definelong\|dump_memory\|else\|enddefinelong\|endfunction\|endif\|endprocedure\|endsub\|exit\|function\|if\|ifdef\|ifndef\|import\|include\|local\|log\|pragma\|procedure\|return\|startsub\|theme\|undef\|unquoted\)\s*.*/ contains=plantumlDir
|
||||
syntax region plantumlDir start=/\s\+/ms=s+1 end=/$/ contained
|
||||
|
||||
" type
|
||||
" From 'java - jar plantuml.jar - language' results {{{
|
||||
syntax keyword plantumlTypeKeyword abstract actor agent annotation archimate artifact boundary card cloud
|
||||
syntax keyword plantumlTypeKeyword collections component control database diamond entity enum file folder frame
|
||||
syntax keyword plantumlTypeKeyword hexagon label node object package participant person queue rectangle stack state
|
||||
syntax keyword plantumlTypeKeyword storage usecase
|
||||
" class and interface are defined as plantumlClassKeyword
|
||||
syntax keyword plantumlClassKeyword class interface
|
||||
"}}}
|
||||
" Not in 'java - jar plantuml.jar - language' results
|
||||
syntax keyword plantumlTypeKeyword concise robust
|
||||
|
||||
" keyword
|
||||
" From 'java - jar plantuml.jar - language' results {{{
|
||||
" Since "syntax keyword" can handle only words, "top to bottom direction", "left to right direction" are excluded.
|
||||
syntax keyword plantumlKeyword across activate again allow_mixing allowmixing also alt as autonumber bold
|
||||
syntax keyword plantumlKeyword bottom box break caption center circle color create critical dashed deactivate
|
||||
syntax keyword plantumlKeyword description destroy detach dotted down else elseif empty end endif endwhile
|
||||
syntax keyword plantumlKeyword false footbox footer fork group header hide hnote if is italic kill left legend
|
||||
syntax keyword plantumlKeyword link loop mainframe map members namespace newpage normal note of on opt order
|
||||
syntax keyword plantumlKeyword over package page par partition plain ref repeat return right rnote rotate show
|
||||
syntax keyword plantumlKeyword skin skinparam split sprite start stereotype stop style then title top true up
|
||||
syntax keyword plantumlKeyword while
|
||||
|
||||
"}}}
|
||||
" Not in 'java - jar plantuml.jar - language' results
|
||||
syntax keyword plantumlKeyword endlegend sprite then
|
||||
" gantt
|
||||
syntax keyword plantumlTypeKeyword monday tuesday wednesday thursday friday saturday sunday today
|
||||
syntax keyword plantumlTypeKeyword project Project labels Labels last first column
|
||||
syntax keyword plantumlKeyword starts ends start end closed after colored lasts happens in at are to the and
|
||||
syntax keyword plantumlKeyword printscale ganttscale projectscale daily weekly monthly quarterly yearly zoom
|
||||
syntax keyword plantumlKeyword day days week weeks today then complete displays same row pauses
|
||||
|
||||
syntax keyword plantumlCommentTODO XXX TODO FIXME NOTE contained
|
||||
syntax match plantumlColor /#[0-9A-Fa-f]\{6\}\>/
|
||||
syntax case ignore
|
||||
syntax keyword plantumlColor APPLICATION AliceBlue AntiqueWhite Aqua Aquamarine Azure BUSINESS Beige Bisque
|
||||
syntax keyword plantumlColor Black BlanchedAlmond Blue BlueViolet Brown BurlyWood CadetBlue Chartreuse
|
||||
syntax keyword plantumlColor Chocolate Coral CornflowerBlue Cornsilk Crimson Cyan DarkBlue DarkCyan
|
||||
syntax keyword plantumlColor DarkGoldenRod DarkGray DarkGreen DarkGrey DarkKhaki DarkMagenta DarkOliveGreen
|
||||
syntax keyword plantumlColor DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray
|
||||
syntax keyword plantumlColor DarkSlateGrey DarkTurquoise DarkViolet Darkorange DeepPink DeepSkyBlue DimGray
|
||||
syntax keyword plantumlColor DimGrey DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro
|
||||
syntax keyword plantumlColor GhostWhite Gold GoldenRod Gray Green GreenYellow Grey HoneyDew HotPink
|
||||
syntax keyword plantumlColor IMPLEMENTATION IndianRed Indigo Ivory Khaki Lavender LavenderBlush LawnGreen
|
||||
syntax keyword plantumlColor LemonChiffon LightBlue LightCoral LightCyan LightGoldenRodYellow LightGray
|
||||
syntax keyword plantumlColor LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue
|
||||
syntax keyword plantumlColor LightSlateGray LightSlateGrey LightSteelBlue LightYellow Lime LimeGreen Linen
|
||||
syntax keyword plantumlColor MOTIVATION Magenta Maroon MediumAquaMarine MediumBlue MediumOrchid MediumPurple
|
||||
syntax keyword plantumlColor MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed
|
||||
syntax keyword plantumlColor MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy OldLace Olive
|
||||
syntax keyword plantumlColor OliveDrab Orange OrangeRed Orchid PHYSICAL PaleGoldenRod PaleGreen PaleTurquoise
|
||||
syntax keyword plantumlColor PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple Red
|
||||
syntax keyword plantumlColor RosyBrown RoyalBlue STRATEGY SaddleBrown Salmon SandyBrown SeaGreen SeaShell
|
||||
syntax keyword plantumlColor Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey Snow SpringGreen SteelBlue
|
||||
syntax keyword plantumlColor TECHNOLOGY Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke
|
||||
syntax keyword plantumlColor Yellow YellowGreen
|
||||
syntax case match
|
||||
|
||||
" Arrows
|
||||
syntax match plantumlArrow /.\@=\([.-]\)\1\+\ze\s*\%(\w\|(\)/
|
||||
|
||||
syntax match plantumlClassRelationLR /\([-.]\)\1*\%(\w\{,5\}\1\+\)\?\%(|>\|>\|*\|o\|x\|#\|{\|+\|\^\)/ contains=plantumlArrowDirectedLine
|
||||
syntax match plantumlClassRelationRL /\%(<|\|<\|*\|o\|x\|#\|}\|+\|\^\)\([-.]\)\1*\%(\w\{,5\}\1\+\)\?/ contains=plantumlArrowDirectedLine
|
||||
|
||||
syntax match plantumlArrowLR /\[\?\([-.]\)\1*\%(\w\{,5}\1\+\)\?\%(\[[^\]]\+\]\)\?\1*\(>\|\\\|\/\)\2\?[ox]\?\]\?\%(\[[^\]]*\]\)\?/ contains=plantumlText,plantumlArrowDirectedLine
|
||||
syntax match plantumlArrowRL /\[\?[ox]\?\(<\|\\\|\/\)\1\?\([-.]\)\2*\%(\w\{,5}\2\+\)\?\]\?\%(\[[^\]]*\]\)\?/ contains=plantumlText,plantumlArrowDirectedLine
|
||||
syntax match plantumlArrowBoth /[ox]\?\(<\|\\\|\/\)\1\?\([-.]\)\2*\%(\w\{,5}\2\+\)\?\(>\|\\\|\/\)\3\?[ox]\?/ contains=plantumlArrowDirectedLine
|
||||
syntax region plantumlText oneline start=/\[/ms=s+1 end=/\]/me=s-1 contained
|
||||
|
||||
syntax match plantumlArrowDirectedLine /\([-.]\)\%(l\%[eft]\|r\%[ight]\|up\?\|d\%[own]\)\1/ contained
|
||||
|
||||
" Note and legend
|
||||
syntax region plantumlNoteMultiLine start=/\%(^\s*[rh]\?\%(note\|legend\)\)\@<=\s\%([^:"]\+$\)\@=/ end=/^\%(\s*\zeend\s*[rh]\?\%(note\|legend\)$\)\|endlegend\@=/ contains=plantumlSpecialString,plantumlNoteMultiLineStart,plantumlTag
|
||||
syntax match plantumlNoteMultiLineStart /\%(^\s*[rh]\?\%(note\|legend\)\)\@<=\s\%([^:]\+$\)/ contained contains=plantumlKeyword,plantumlColor,plantumlString,plantumlTag
|
||||
|
||||
" Class
|
||||
syntax region plantumlClass
|
||||
\ start=/\%(\%(class\|interface\|object\)\s[^{]\+\)\@<=\zs{/
|
||||
\ end=/^\s*}/
|
||||
\ contains=plantumlClassArrows,
|
||||
\ plantumlClassKeyword,
|
||||
\ @plantumlClassOp,
|
||||
\ plantumlClassSeparator,
|
||||
\ plantumlComment
|
||||
|
||||
syntax match plantumlClassPublic /^\s*+\s*\w\+/ contained
|
||||
syntax match plantumlClassPrivate /^\s*-\s*\w\+/ contained
|
||||
syntax match plantumlClassProtected /^\s*#\s*\w\+/ contained
|
||||
syntax match plantumlClassPackPrivate /^\s*\~\s*\w\+/ contained
|
||||
syntax match plantumlClassSeparator /__\%(.\+__\)\?\|==\%(.\+==\)\?\|--\%(.\+--\)\?\|\.\.\%(.\+\.\.\)\?/ contained
|
||||
|
||||
syntax cluster plantumlClassOp contains=plantumlClassPublic,
|
||||
\ plantumlClassPrivate,
|
||||
\ plantumlClassProtected,
|
||||
\ plantumlClassPackPrivate
|
||||
|
||||
" Strings
|
||||
syntax match plantumlSpecialString /\\n/ contained
|
||||
syntax region plantumlString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=plantumlSpecialString
|
||||
syntax region plantumlString start=/'/ skip=/\\\\\|\\'/ end=/'/ oneline contains=plantumlSpecialString
|
||||
syntax match plantumlComment /^\s*'.*$/ contains=plantumlCommentTODO
|
||||
syntax region plantumlMultilineComment start=/\/'/ end=/'\// contains=plantumlCommentTODO
|
||||
|
||||
syntax match plantumlTag /<\/\?[bi]>/
|
||||
syntax region plantumlTag start=/<\/\?\%(back\|color\|del\|font\|img\|s\|size\|strike\|u\|w\)/ end=/>/
|
||||
|
||||
" Labels with a colon
|
||||
syntax match plantumlColonLine /\S\@<=\s*\zs : .\+$/ contains=plantumlSpecialString
|
||||
|
||||
" Stereotypes
|
||||
syntax match plantumlStereotype /<<[^-.]\+>>/ contains=plantumlSpecialString
|
||||
|
||||
" Activity diagram
|
||||
syntax match plantumlActivityThing /([^)]*)/
|
||||
syntax match plantumlActivitySynch /===[^=]\+===/
|
||||
syntax match plantumlActivityLabel /\%(^\%(#\S\+\)\?\)\@<=:\_[^;|<>/\]}]\+[;|<>/\]}]$/ contains=plantumlSpecialString
|
||||
|
||||
" Sequence diagram
|
||||
syntax match plantumlSequenceDivider /^\s*==[^=]\+==\s*$/
|
||||
syntax match plantumlSequenceSpace /^\s*|||\+\s*$/
|
||||
syntax match plantumlSequenceSpace /^\s*||\d\+||\+\s*$/
|
||||
syntax match plantumlSequenceDelay /^\s*\.\{3}$/
|
||||
syntax region plantumlText oneline matchgroup=plantumlSequenceDelay start=/^\s*\.\{3}/ end=/\.\{3}$/
|
||||
|
||||
" Usecase diagram
|
||||
syntax match plantumlUsecaseActor /^\s*:.\{-1,}:/ contains=plantumlSpecialString
|
||||
|
||||
|
||||
" Mindmap diagram
|
||||
let s:mindmapHilightLinks = [
|
||||
\ 'WarningMsg', 'Directory', 'Special', 'MoreMsg', 'Statement', 'Title',
|
||||
\ 'Question', 'LineNr', 'ModeMsg', 'Title', 'MoreMsg', 'SignColumn',
|
||||
\ 'Function', 'Todo'
|
||||
\ ]
|
||||
|
||||
let s:i = 1
|
||||
let s:contained = []
|
||||
let s:mindmap_color = '\(\[#[^\]]\+\]\)\?'
|
||||
let s:mindmap_removing_box = '_\?'
|
||||
let s:mindmap_options = join([s:mindmap_color, s:mindmap_removing_box], '')
|
||||
while s:i < len(s:mindmapHilightLinks)
|
||||
execute 'syntax match plantumlMindmap' . s:i . ' /^\([-+*]\)\1\{' . (s:i - 1) . '}' . s:mindmap_options . '\(:\|\s\+\)/ contained'
|
||||
execute 'syntax match plantumlMindmap' . s:i . ' /^\s\{' . (s:i - 1) . '}\*' . s:mindmap_options . '\(:\|\s\+\)/ contained'
|
||||
execute 'highlight default link plantumlMindmap' . s:i . ' ' . s:mindmapHilightLinks[s:i - 1]
|
||||
call add(s:contained, 'plantumlMindmap' . s:i)
|
||||
let s:i = s:i + 1
|
||||
endwhile
|
||||
|
||||
execute 'syntax region plantumlMindmap oneline start=/^\([-+*]\)\1*' . s:mindmap_options . '\s/ end=/$/ contains=' . join(s:contained, ',')
|
||||
" Multilines
|
||||
execute 'syntax region plantumlMindmap start=/^\([-+*]\)\1*' . s:mindmap_options . ':/ end=/;$/ contains=' . join(s:contained, ',')
|
||||
" Markdown syntax
|
||||
execute 'syntax region plantumlMindmap oneline start=/^\s*\*' . s:mindmap_options . '\s/ end=/$/ contains=' . join(s:contained, ',')
|
||||
|
||||
" Gantt diagram
|
||||
syntax match plantumlGanttTask /\[[^\]]\{-}\]\%('s\)\?/ contains=plantumlSpecialString
|
||||
|
||||
|
||||
" Skinparam keywords
|
||||
syntax case ignore
|
||||
syntax keyword plantumlSkinparamKeyword ActivityBackgroundColor ActivityBarColor ActivityBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword ActivityBorderThickness ActivityDiamondBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword ActivityDiamondBorderColor ActivityDiamondFontColor ActivityDiamondFontName
|
||||
syntax keyword plantumlSkinparamKeyword ActivityDiamondFontSize ActivityDiamondFontStyle ActivityEndColor
|
||||
syntax keyword plantumlSkinparamKeyword ActivityFontColor ActivityFontName ActivityFontSize ActivityFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ActivityStartColor ActorBackgroundColor ActorBorderColor ActorFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ActorFontName ActorFontSize ActorFontStyle ActorStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ActorStereotypeFontName ActorStereotypeFontSize ActorStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword AgentBackgroundColor AgentBorderColor AgentBorderThickness AgentFontColor
|
||||
syntax keyword plantumlSkinparamKeyword AgentFontName AgentFontSize AgentFontStyle AgentStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword AgentStereotypeFontName AgentStereotypeFontSize AgentStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ArchimateBackgroundColor ArchimateBorderColor ArchimateBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword ArchimateFontColor ArchimateFontName ArchimateFontSize ArchimateFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ArchimateStereotypeFontColor ArchimateStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword ArchimateStereotypeFontSize ArchimateStereotypeFontStyle ArrowColor
|
||||
syntax keyword plantumlSkinparamKeyword ArrowFontColor ArrowFontName ArrowFontSize ArrowFontStyle ArrowHeadColor
|
||||
syntax keyword plantumlSkinparamKeyword ArrowLollipopColor ArrowMessageAlignment ArrowThickness ArtifactBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword ArtifactBorderColor ArtifactFontColor ArtifactFontName ArtifactFontSize
|
||||
syntax keyword plantumlSkinparamKeyword ArtifactFontStyle ArtifactStereotypeFontColor ArtifactStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword ArtifactStereotypeFontSize ArtifactStereotypeFontStyle BackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword BiddableBackgroundColor BiddableBorderColor BoundaryBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword BoundaryBorderColor BoundaryFontColor BoundaryFontName BoundaryFontSize
|
||||
syntax keyword plantumlSkinparamKeyword BoundaryFontStyle BoundaryStereotypeFontColor BoundaryStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword BoundaryStereotypeFontSize BoundaryStereotypeFontStyle BoxPadding
|
||||
syntax keyword plantumlSkinparamKeyword CaptionFontColor CaptionFontName CaptionFontSize CaptionFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword CardBackgroundColor CardBorderColor CardBorderThickness CardFontColor
|
||||
syntax keyword plantumlSkinparamKeyword CardFontName CardFontSize CardFontStyle CardStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword CardStereotypeFontName CardStereotypeFontSize CardStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword CircledCharacterFontColor CircledCharacterFontName CircledCharacterFontSize
|
||||
syntax keyword plantumlSkinparamKeyword CircledCharacterFontStyle CircledCharacterRadius ClassAttributeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ClassAttributeFontName ClassAttributeFontSize ClassAttributeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ClassAttributeIconSize ClassBackgroundColor ClassBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword ClassBorderThickness ClassFontColor ClassFontName ClassFontSize ClassFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ClassHeaderBackgroundColor ClassStereotypeFontColor ClassStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword ClassStereotypeFontSize ClassStereotypeFontStyle CloudBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword CloudBorderColor CloudFontColor CloudFontName CloudFontSize CloudFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword CloudStereotypeFontColor CloudStereotypeFontName CloudStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword CloudStereotypeFontStyle CollectionsBackgroundColor CollectionsBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword ColorArrowSeparationSpace ComponentBackgroundColor ComponentBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword ComponentBorderThickness ComponentFontColor ComponentFontName ComponentFontSize
|
||||
syntax keyword plantumlSkinparamKeyword ComponentFontStyle ComponentStereotypeFontColor ComponentStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword ComponentStereotypeFontSize ComponentStereotypeFontStyle ComponentStyle
|
||||
syntax keyword plantumlSkinparamKeyword ConditionEndStyle ConditionStyle ControlBackgroundColor ControlBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword ControlFontColor ControlFontName ControlFontSize ControlFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ControlStereotypeFontColor ControlStereotypeFontName ControlStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword ControlStereotypeFontStyle DatabaseBackgroundColor DatabaseBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword DatabaseFontColor DatabaseFontName DatabaseFontSize DatabaseFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword DatabaseStereotypeFontColor DatabaseStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword DatabaseStereotypeFontSize DatabaseStereotypeFontStyle DefaultFontColor
|
||||
syntax keyword plantumlSkinparamKeyword DefaultFontName DefaultFontSize DefaultFontStyle DefaultMonospacedFontName
|
||||
syntax keyword plantumlSkinparamKeyword DefaultTextAlignment DesignedBackgroundColor DesignedBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword DesignedDomainBorderThickness DesignedDomainFontColor DesignedDomainFontName
|
||||
syntax keyword plantumlSkinparamKeyword DesignedDomainFontSize DesignedDomainFontStyle DesignedDomainStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword DesignedDomainStereotypeFontName DesignedDomainStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword DesignedDomainStereotypeFontStyle DiagramBorderColor DiagramBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword DomainBackgroundColor DomainBorderColor DomainBorderThickness DomainFontColor
|
||||
syntax keyword plantumlSkinparamKeyword DomainFontName DomainFontSize DomainFontStyle DomainStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword DomainStereotypeFontName DomainStereotypeFontSize DomainStereotypeFontStyle Dpi
|
||||
syntax keyword plantumlSkinparamKeyword EntityBackgroundColor EntityBorderColor EntityFontColor EntityFontName
|
||||
syntax keyword plantumlSkinparamKeyword EntityFontSize EntityFontStyle EntityStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword EntityStereotypeFontName EntityStereotypeFontSize EntityStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword EnumBackgroundColor FileBackgroundColor FileBorderColor FileFontColor
|
||||
syntax keyword plantumlSkinparamKeyword FileFontName FileFontSize FileFontStyle FileStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword FileStereotypeFontName FileStereotypeFontSize FileStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword FixCircleLabelOverlapping FolderBackgroundColor FolderBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword FolderFontColor FolderFontName FolderFontSize FolderFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword FolderStereotypeFontColor FolderStereotypeFontName FolderStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword FolderStereotypeFontStyle FooterFontColor FooterFontName FooterFontSize
|
||||
syntax keyword plantumlSkinparamKeyword FooterFontStyle FrameBackgroundColor FrameBorderColor FrameFontColor
|
||||
syntax keyword plantumlSkinparamKeyword FrameFontName FrameFontSize FrameFontStyle FrameStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword FrameStereotypeFontName FrameStereotypeFontSize FrameStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword GenericDisplay Guillemet Handwritten HeaderFontColor HeaderFontName
|
||||
syntax keyword plantumlSkinparamKeyword HeaderFontSize HeaderFontStyle HexagonBackgroundColor HexagonBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword HexagonBorderThickness HexagonFontColor HexagonFontName HexagonFontSize
|
||||
syntax keyword plantumlSkinparamKeyword HexagonFontStyle HexagonStereotypeFontColor HexagonStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword HexagonStereotypeFontSize HexagonStereotypeFontStyle HyperlinkColor
|
||||
syntax keyword plantumlSkinparamKeyword HyperlinkUnderline IconIEMandatoryColor IconPackageBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword IconPackageColor IconPrivateBackgroundColor IconPrivateColor
|
||||
syntax keyword plantumlSkinparamKeyword IconProtectedBackgroundColor IconProtectedColor IconPublicBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword IconPublicColor InterfaceBackgroundColor InterfaceBorderColor InterfaceFontColor
|
||||
syntax keyword plantumlSkinparamKeyword InterfaceFontName InterfaceFontSize InterfaceFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword InterfaceStereotypeFontColor InterfaceStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword InterfaceStereotypeFontSize InterfaceStereotypeFontStyle LabelFontColor
|
||||
syntax keyword plantumlSkinparamKeyword LabelFontName LabelFontSize LabelFontStyle LabelStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword LabelStereotypeFontName LabelStereotypeFontSize LabelStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword LegendBackgroundColor LegendBorderColor LegendBorderThickness LegendFontColor
|
||||
syntax keyword plantumlSkinparamKeyword LegendFontName LegendFontSize LegendFontStyle LexicalBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword LexicalBorderColor LifelineStrategy Linetype MachineBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword MachineBorderColor MachineBorderThickness MachineFontColor MachineFontName
|
||||
syntax keyword plantumlSkinparamKeyword MachineFontSize MachineFontStyle MachineStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword MachineStereotypeFontName MachineStereotypeFontSize MachineStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword MaxAsciiMessageLength MaxMessageSize MinClassWidth Monochrome
|
||||
syntax keyword plantumlSkinparamKeyword NodeBackgroundColor NodeBorderColor NodeFontColor NodeFontName NodeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword NodeFontStyle NodeStereotypeFontColor NodeStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword NodeStereotypeFontSize NodeStereotypeFontStyle Nodesep NoteBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword NoteBorderColor NoteBorderThickness NoteFontColor NoteFontName NoteFontSize
|
||||
syntax keyword plantumlSkinparamKeyword NoteFontStyle NoteShadowing NoteTextAlignment ObjectAttributeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ObjectAttributeFontName ObjectAttributeFontSize ObjectAttributeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ObjectBackgroundColor ObjectBorderColor ObjectBorderThickness ObjectFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ObjectFontName ObjectFontSize ObjectFontStyle ObjectStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ObjectStereotypeFontName ObjectStereotypeFontSize ObjectStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword PackageBackgroundColor PackageBorderColor PackageBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword PackageFontColor PackageFontName PackageFontSize PackageFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword PackageStereotypeFontColor PackageStereotypeFontName PackageStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword PackageStereotypeFontStyle PackageStyle PackageTitleAlignment Padding
|
||||
syntax keyword plantumlSkinparamKeyword PageBorderColor PageExternalColor PageMargin ParticipantBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword ParticipantBorderColor ParticipantFontColor ParticipantFontName
|
||||
syntax keyword plantumlSkinparamKeyword ParticipantFontSize ParticipantFontStyle ParticipantPadding
|
||||
syntax keyword plantumlSkinparamKeyword ParticipantStereotypeFontColor ParticipantStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword ParticipantStereotypeFontSize ParticipantStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword PartitionBackgroundColor PartitionBorderColor PartitionBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword PartitionFontColor PartitionFontName PartitionFontSize PartitionFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword PathHoverColor PersonBackgroundColor PersonBorderColor PersonBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword PersonFontColor PersonFontName PersonFontSize PersonFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword PersonStereotypeFontColor PersonStereotypeFontName PersonStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword PersonStereotypeFontStyle QueueBackgroundColor QueueBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword QueueBorderThickness QueueFontColor QueueFontName QueueFontSize QueueFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword QueueStereotypeFontColor QueueStereotypeFontName QueueStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword QueueStereotypeFontStyle Ranksep RectangleBackgroundColor RectangleBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword RectangleBorderThickness RectangleFontColor RectangleFontName RectangleFontSize
|
||||
syntax keyword plantumlSkinparamKeyword RectangleFontStyle RectangleStereotypeFontColor RectangleStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword RectangleStereotypeFontSize RectangleStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword RequirementBackgroundColor RequirementBorderColor RequirementBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword RequirementFontColor RequirementFontName RequirementFontSize
|
||||
syntax keyword plantumlSkinparamKeyword RequirementFontStyle RequirementStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword RequirementStereotypeFontName RequirementStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword RequirementStereotypeFontStyle ResponseMessageBelowArrow RoundCorner
|
||||
syntax keyword plantumlSkinparamKeyword SameClassWidth SequenceActorBorderThickness SequenceArrowThickness
|
||||
syntax keyword plantumlSkinparamKeyword SequenceBoxBackgroundColor SequenceBoxBorderColor SequenceBoxFontColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceBoxFontName SequenceBoxFontSize SequenceBoxFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword SequenceDelayFontColor SequenceDelayFontName SequenceDelayFontSize
|
||||
syntax keyword plantumlSkinparamKeyword SequenceDelayFontStyle SequenceDividerBackgroundColor SequenceDividerBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceDividerBorderThickness SequenceDividerFontColor SequenceDividerFontName
|
||||
syntax keyword plantumlSkinparamKeyword SequenceDividerFontSize SequenceDividerFontStyle SequenceGroupBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupBodyBackgroundColor SequenceGroupBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupBorderThickness SequenceGroupFontColor SequenceGroupFontName
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupFontSize SequenceGroupFontStyle SequenceGroupHeaderFontColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupHeaderFontName SequenceGroupHeaderFontSize
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupHeaderFontStyle SequenceLifeLineBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceLifeLineBorderColor SequenceLifeLineBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword SequenceMessageAlignment SequenceMessageTextAlignment
|
||||
syntax keyword plantumlSkinparamKeyword SequenceNewpageSeparatorColor SequenceParticipant
|
||||
syntax keyword plantumlSkinparamKeyword SequenceParticipantBorderThickness SequenceReferenceAlignment
|
||||
syntax keyword plantumlSkinparamKeyword SequenceReferenceBackgroundColor SequenceReferenceBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceReferenceBorderThickness SequenceReferenceFontColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceReferenceFontName SequenceReferenceFontSize SequenceReferenceFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword SequenceReferenceHeaderBackgroundColor SequenceStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceStereotypeFontName SequenceStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword SequenceStereotypeFontStyle Shadowing StackBackgroundColor StackBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword StackFontColor StackFontName StackFontSize StackFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword StackStereotypeFontColor StackStereotypeFontName StackStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword StackStereotypeFontStyle StateAttributeFontColor StateAttributeFontName
|
||||
syntax keyword plantumlSkinparamKeyword StateAttributeFontSize StateAttributeFontStyle StateBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword StateBorderColor StateEndColor StateFontColor StateFontName StateFontSize
|
||||
syntax keyword plantumlSkinparamKeyword StateFontStyle StateMessageAlignment StateStartColor StereotypeABackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword StereotypeABorderColor StereotypeCBackgroundColor StereotypeCBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword StereotypeEBackgroundColor StereotypeEBorderColor StereotypeIBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword StereotypeIBorderColor StereotypeNBackgroundColor StereotypeNBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword StereotypePosition StorageBackgroundColor StorageBorderColor StorageFontColor
|
||||
syntax keyword plantumlSkinparamKeyword StorageFontName StorageFontSize StorageFontStyle StorageStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword StorageStereotypeFontName StorageStereotypeFontSize StorageStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword Style SvglinkTarget SwimlaneBorderColor SwimlaneBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword SwimlaneTitleBackgroundColor SwimlaneTitleFontColor SwimlaneTitleFontName
|
||||
syntax keyword plantumlSkinparamKeyword SwimlaneTitleFontSize SwimlaneTitleFontStyle SwimlaneWidth
|
||||
syntax keyword plantumlSkinparamKeyword SwimlaneWrapTitleWidth TabSize TimingFontColor TimingFontName TimingFontSize
|
||||
syntax keyword plantumlSkinparamKeyword TimingFontStyle TitleBackgroundColor TitleBorderColor TitleBorderRoundCorner
|
||||
syntax keyword plantumlSkinparamKeyword TitleBorderThickness TitleFontColor TitleFontName TitleFontSize TitleFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword UsecaseBackgroundColor UsecaseBorderColor UsecaseBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword UsecaseFontColor UsecaseFontName UsecaseFontSize UsecaseFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword UsecaseStereotypeFontColor UsecaseStereotypeFontName UsecaseStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword UsecaseStereotypeFontStyle WrapWidth
|
||||
|
||||
" Not in 'java - jar plantuml.jar - language' output
|
||||
syntax keyword plantumlSkinparamKeyword activityArrowColor activityArrowFontColor activityArrowFontName
|
||||
syntax keyword plantumlSkinparamKeyword activityArrowFontSize activityArrowFontStyle BarColor BorderColor
|
||||
syntax keyword plantumlSkinparamKeyword CharacterFontColor CharacterFontName CharacterFontSize CharacterFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword CharacterRadius classArrowColor classArrowFontColor classArrowFontName
|
||||
syntax keyword plantumlSkinparamKeyword classArrowFontSize classArrowFontStyle Color componentArrowColor
|
||||
syntax keyword plantumlSkinparamKeyword componentArrowFontColor componentArrowFontName componentArrowFontSize
|
||||
syntax keyword plantumlSkinparamKeyword componentArrowFontStyle componentInterfaceBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword componentInterfaceBorderColor DividerBackgroundColor DividerFontColor
|
||||
syntax keyword plantumlSkinparamKeyword DividerFontName DividerFontSize DividerFontStyle EndColor FontColor FontName
|
||||
syntax keyword plantumlSkinparamKeyword FontSize FontStyle GroupBackgroundColor GroupingFontColor GroupingFontName
|
||||
syntax keyword plantumlSkinparamKeyword GroupingFontSize GroupingFontStyle GroupingHeaderFontColor
|
||||
syntax keyword plantumlSkinparamKeyword GroupingHeaderFontName GroupingHeaderFontSize GroupingHeaderFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword LifeLineBackgroundColor LifeLineBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword LineColor LineStyle LineThickness
|
||||
syntax keyword plantumlSkinparamKeyword sequenceActorBackgroundColor sequenceActorBorderColor sequenceActorFontColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceActorFontName sequenceActorFontSize sequenceActorFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword sequenceArrowColor sequenceArrowFontColor sequenceArrowFontName
|
||||
syntax keyword plantumlSkinparamKeyword sequenceArrowFontSize sequenceArrowFontStyle sequenceGroupingFontColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingFontName sequenceGroupingFontSize sequenceGroupingFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingHeaderFontColor sequenceGroupingHeaderFontName
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingHeaderFontSize sequenceGroupingHeaderFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantBackgroundColor sequenceParticipantBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantFontColor sequenceParticipantFontName
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantFontSize sequenceParticipantFontStyle StartColor
|
||||
syntax keyword plantumlSkinparamKeyword stateArrowColor stateArrowFontColor stateArrowFontName stateArrowFontSize
|
||||
syntax keyword plantumlSkinparamKeyword stateArrowFontStyle StereotypeFontColor StereotypeFontName StereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword StereotypeFontStyle usecaseActorBackgroundColor usecaseActorBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorFontColor usecaseActorFontName usecaseActorFontSize
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorFontStyle usecaseActorStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorStereotypeFontName usecaseActorStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorStereotypeFontStyle usecaseArrowColor usecaseArrowFontColor
|
||||
syntax keyword plantumlSkinparamKeyword usecaseArrowFontName usecaseArrowFontSize usecaseArrowFontStyle
|
||||
syntax case match
|
||||
|
||||
" Builtin Function
|
||||
" https://plantuml.com/ja/preprocessing
|
||||
syntax match plantumlBuiltinFunction /%\%(chr\|darken\|date\|dec2hex\|dirpath\|feature\|false\|file_exists\|filename\|function_exists\|get_variable_value\|getenv\|hex2dec\|hsl_color\|intval\|is_dark\|is_light\|lighten\|loadJSON\|lower\|newline\|not\|lighten\|reverse_color\|reverse_hsluv_color\|set_variable_value\|size\|string\|strlen\|strpos\|substr\|true\|upper\|variable_exists\|version\)/
|
||||
|
||||
" Highlight
|
||||
highlight default link plantumlCommentTODO Todo
|
||||
highlight default link plantumlKeyword Keyword
|
||||
highlight default link plantumlClassKeyword Keyword
|
||||
highlight default link plantumlTypeKeyword Type
|
||||
highlight default link plantumlPreProc PreProc
|
||||
highlight default link plantumlDir Constant
|
||||
highlight default link plantumlColor Constant
|
||||
highlight default link plantumlArrow Identifier
|
||||
highlight default link plantumlArrowBoth Identifier
|
||||
highlight default link plantumlArrowLR Identifier
|
||||
highlight default link plantumlArrowRL Identifier
|
||||
highlight default link plantumlArrowDirectedLine Identifier
|
||||
highlight default link plantumlClassRelationLR Identifier
|
||||
highlight default link plantumlClassRelationRL Identifier
|
||||
highlight default link plantumlText Label
|
||||
highlight default link plantumlClass Type
|
||||
highlight default link plantumlClassPublic Structure
|
||||
highlight default link plantumlClassPrivate Macro
|
||||
highlight default link plantumlClassProtected Statement
|
||||
highlight default link plantumlClassPackPrivate Function
|
||||
highlight default link plantumlClassSeparator Comment
|
||||
highlight default link plantumlSequenceDivider Comment
|
||||
highlight default link plantumlSequenceSpace Comment
|
||||
highlight default link plantumlTag Identifier
|
||||
highlight default link plantumlSequenceDelay Identifier
|
||||
highlight default link plantumlSpecialString Special
|
||||
highlight default link plantumlString String
|
||||
highlight default link plantumlComment Comment
|
||||
highlight default link plantumlMultilineComment Comment
|
||||
highlight default link plantumlColonLine Comment
|
||||
highlight default link plantumlActivityThing Type
|
||||
highlight default link plantumlActivitySynch Type
|
||||
highlight default link plantumlActivityLabel String
|
||||
highlight default link plantumlSkinparamKeyword Identifier
|
||||
highlight default link plantumlNoteMultiLine String
|
||||
highlight default link plantumlUsecaseActor String
|
||||
highlight default link plantumlStereotype Type
|
||||
highlight default link plantumlBuiltinFunction Function
|
||||
highlight default link plantumlGanttTask Type
|
||||
|
||||
let &cpoptions=s:cpo_orig
|
||||
unlet s:cpo_orig
|
3
bundle/vim-slumlord/.gitignore
vendored
Normal file
3
bundle/vim-slumlord/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*~
|
||||
*.swp
|
||||
tags
|
13
bundle/vim-slumlord/LICENCE
vendored
Normal file
13
bundle/vim-slumlord/LICENCE
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
52
bundle/vim-slumlord/README.md
vendored
Normal file
52
bundle/vim-slumlord/README.md
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
Oh shit! Lock up your daughters it's ...
|
||||
|
||||
```
|
||||
███████╗██╗ ██╗ ██╗███╗ ███╗██╗ ██████╗ ██████╗ ██████╗
|
||||
██╔════╝██║ ██║ ██║████╗ ████║██║ ██╔═══██╗██╔══██╗██╔══██╗
|
||||
███████╗██║ ██║ ██║██╔████╔██║██║ ██║ ██║██████╔╝██║ ██║
|
||||
╚════██║██║ ██║ ██║██║╚██╔╝██║██║ ██║ ██║██╔══██╗██║ ██║
|
||||
███████║███████╗╚██████╔╝██║ ╚═╝ ██║███████╗╚██████╔╝██║ ██║██████╔╝
|
||||
╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝
|
||||
```
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
Slumlord is built atop the wang-hardeningly awesome [plantuml](http://plantuml.com).
|
||||
It gives you a "live preview" of your UML diagrams when you save.
|
||||
|
||||

|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
First you need Java installed.
|
||||
|
||||
Then, install this plugin with your favourite vim plugin manager.
|
||||
|
||||
For [vundle](https://github.com/VundleVim/Vundle.vim), just stick this in your
|
||||
vimrc and smoke it:
|
||||
|
||||
```
|
||||
Plugin 'scrooloose/vim-slumlord'
|
||||
```
|
||||
|
||||
Then run `:Vundle install`
|
||||
|
||||
I also recommend installing the
|
||||
[plantuml-syntax](https://github.com/aklt/plantuml-syntax) plugin as Slumlord
|
||||
uses this for its syntax file.
|
||||
|
||||
```
|
||||
Plugin 'aklt/plantuml-syntax'
|
||||
```
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Edit a `.uml` file and enter some plantuml code. When you save it, a preview
|
||||
will be forcefully inserted/updated at the top of your file!
|
||||
|
||||
Note: I have only used this for sequence diagrams - the ASCII output of
|
||||
plantuml seems to be less than stellar for other diagram types.
|
BIN
bundle/vim-slumlord/_assets/demo.gif
vendored
Normal file
BIN
bundle/vim-slumlord/_assets/demo.gif
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 470 KiB |
272
bundle/vim-slumlord/autoload/slumlord.vim
vendored
Normal file
272
bundle/vim-slumlord/autoload/slumlord.vim
vendored
Normal file
@ -0,0 +1,272 @@
|
||||
" PlantUML Live Preview for ascii/unicode art
|
||||
" @Author: Martin Grenfell <martin.grenfell@gmail.com>
|
||||
" @Date: 2018-12-07 13:00:22
|
||||
" @Last Modified by: Tsuyoshi CHO <Tsuyoshi.CHO@Gmail.com>
|
||||
" @Last Modified time: 2018-12-08 00:02:38
|
||||
" @License: WTFPL
|
||||
" PlantUML preview plugin core
|
||||
|
||||
" Intro {{{1
|
||||
if exists("g:autoloaded_slumlord")
|
||||
finish
|
||||
endif
|
||||
let g:autoloaded_slumlord = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" variable {{{1
|
||||
let g:slumlord_plantuml_jar_path = get(g:, 'slumlord_plantuml_jar_path', expand("<sfile>:p:h") . "/../plantuml.jar")
|
||||
let g:slumlord_plantuml_include_path = get(g:, 'slumlord_plantuml_include_path', expand("~/.config/plantuml/include/"))
|
||||
let g:slumlord_asciiart_utf = get(g:, 'slumlord_asciiart_utf', 1)
|
||||
|
||||
" function {{{1
|
||||
function! slumlord#updatePreview(args) abort
|
||||
if !s:shouldInsertPreview()
|
||||
return
|
||||
end
|
||||
|
||||
let charset = 'UTF-8'
|
||||
|
||||
let type = 'utxt'
|
||||
let ext = 'utxt'
|
||||
if !g:slumlord_asciiart_utf
|
||||
let type = 'txt'
|
||||
let ext = 'atxt'
|
||||
endif
|
||||
|
||||
let tmpfname = tempname()
|
||||
call s:mungeDiagramInTmpFile(tmpfname)
|
||||
let b:slumlord_preview_fname = fnamemodify(tmpfname, ':r') . '.' . ext
|
||||
|
||||
let cmd = "java -Dapple.awt.UIElement=true -Dplantuml.include.path=\"". g:slumlord_plantuml_include_path ."\" -splash: -jar ". g:slumlord_plantuml_jar_path ." -charset ". charset ." -t" . type ." ". tmpfname
|
||||
|
||||
let write = has_key(a:args, 'write') && a:args["write"] == 1
|
||||
if exists("*jobstart")
|
||||
call jobstart(cmd, { "on_exit": function("s:asyncHandlerAdapter"), "write": write, "bufnr": bufnr("") })
|
||||
elseif exists("*job_start")
|
||||
call job_start(cmd, { "exit_cb": {job,st->call('s:asyncHandlerAdapter',[job,st,0],{"bufnr": bufnr(""),"write": write})}, "out_io": "buffer", "out_buf": bufnr("") })
|
||||
else
|
||||
call system(cmd)
|
||||
if v:shell_error == 0
|
||||
call s:updater.update(a:args)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:shouldInsertPreview() abort
|
||||
"check for 'no-preview flag
|
||||
if search('^\s*''no-preview', 'wn') > 0
|
||||
return
|
||||
endif
|
||||
|
||||
"check for state diagram
|
||||
if search('^\s*\[\*\]', 'wn') > 0
|
||||
return
|
||||
endif
|
||||
|
||||
"check for use cases
|
||||
if search('^\s*\%((.*)\|:.*:\)', 'wn') > 0
|
||||
return
|
||||
endif
|
||||
|
||||
"check for class diagrams
|
||||
if search('^\s*class\>', 'wn') > 0
|
||||
return
|
||||
endif
|
||||
|
||||
"check for activity diagrams
|
||||
if search('^\s*:.*;', 'wn') > 0
|
||||
return
|
||||
endif
|
||||
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! s:asyncHandlerAdapter(job_id, data, event) abort dict
|
||||
if a:data != 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
if bufnr("") != self.bufnr
|
||||
return 0
|
||||
endif
|
||||
|
||||
call s:updater.update(self)
|
||||
endfunction
|
||||
|
||||
function! s:readWithoutStoringAsAltFile(fname) abort
|
||||
let oldcpoptions = &cpoptions
|
||||
set cpoptions-=a
|
||||
exec 'read' a:fname
|
||||
let &cpoptions = oldcpoptions
|
||||
endfunction
|
||||
|
||||
function! s:mungeDiagramInTmpFile(fname) abort
|
||||
call writefile(getline(1, '$'), a:fname)
|
||||
call s:convertNonAsciiSupportedSyntax(a:fname)
|
||||
endfunction
|
||||
|
||||
function! s:convertNonAsciiSupportedSyntax(fname) abort
|
||||
exec 'sp' a:fname
|
||||
|
||||
/@startuml/,/@enduml/s/^\s*\(boundary\|database\|entity\|control\)/participant/e
|
||||
/@startuml/,/@enduml/s/^\s*\(end \)\?\zsref\>/note/e
|
||||
/@startuml/,/@enduml/s/^\s*ref\>/note/e
|
||||
/@startuml/,/@enduml/s/|||/||4||/e
|
||||
/@startuml/,/@enduml/s/\.\.\.\([^.]*\)\.\.\./==\1==/e
|
||||
write
|
||||
|
||||
bwipe!
|
||||
endfunction
|
||||
|
||||
function! s:removeLeadingWhitespace(...) abort
|
||||
let opts = a:0 ? a:1 : {}
|
||||
|
||||
let diagramEnd = get(opts, 'diagramEnd', line('$'))
|
||||
|
||||
let smallestLead = 100
|
||||
|
||||
for i in range(1, diagramEnd-1)
|
||||
let lead = match(getline(i), '\S')
|
||||
if lead >= 0 && lead < smallestLead
|
||||
let smallestLead = lead
|
||||
endif
|
||||
endfor
|
||||
|
||||
exec '1,' . diagramEnd . 's/^ \{'.smallestLead.'}//e'
|
||||
endfunction
|
||||
|
||||
function! s:addTitle() abort
|
||||
let lnum = search('^title ', 'n')
|
||||
if !lnum
|
||||
return
|
||||
endif
|
||||
|
||||
let title = substitute(getline(lnum), '^title \(.*\)', '\1', '')
|
||||
|
||||
call append(0, "")
|
||||
call append(0, repeat("^", strdisplaywidth(title)+6))
|
||||
call append(0, " " . title)
|
||||
endfunction
|
||||
|
||||
" InPlaceUpdater object {{{1
|
||||
let s:InPlaceUpdater = {}
|
||||
let s:InPlaceUpdater.divider = "@startuml"
|
||||
|
||||
function! s:InPlaceUpdater.update(args) abort
|
||||
let startLine = line(".")
|
||||
let lastLine = line("$")
|
||||
let startCol = col(".")
|
||||
|
||||
call self.__deletePreviousDiagram()
|
||||
call self.__insertDiagram(b:slumlord_preview_fname)
|
||||
call s:addTitle()
|
||||
|
||||
call cursor(line("$") - (lastLine - startLine), startCol)
|
||||
|
||||
if a:args['write']
|
||||
noautocmd write
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:InPlaceUpdater.__deletePreviousDiagram() abort
|
||||
if self.__dividerLnum() > 1
|
||||
exec '0,' . (self.__dividerLnum() - 1) . 'delete _'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:InPlaceUpdater.__insertDiagram(fname) abort
|
||||
call append(0, "")
|
||||
call append(0, "")
|
||||
0
|
||||
|
||||
call s:readWithoutStoringAsAltFile(a:fname)
|
||||
|
||||
"fix trailing whitespace
|
||||
exec '1,' . self.__dividerLnum() . 's/\s\+$//e'
|
||||
|
||||
call s:removeLeadingWhitespace()
|
||||
endfunction
|
||||
|
||||
function! s:InPlaceUpdater.__dividerLnum() abort
|
||||
return search(self.divider, 'wn')
|
||||
endfunction
|
||||
|
||||
" WinUpdater object {{{1
|
||||
let s:WinUpdater = {}
|
||||
function! s:WinUpdater.update(args) abort
|
||||
let fname = b:slumlord_preview_fname
|
||||
call self.__moveToWin()
|
||||
%d
|
||||
|
||||
call append(0, "")
|
||||
call append(0, "")
|
||||
0
|
||||
|
||||
call s:readWithoutStoringAsAltFile(fname)
|
||||
|
||||
"fix trailing whitespace
|
||||
%s/\s\+$//e
|
||||
|
||||
call s:removeLeadingWhitespace()
|
||||
call s:addTitle()
|
||||
wincmd p
|
||||
endfunction
|
||||
|
||||
function s:WinUpdater.__moveToWin() abort
|
||||
if exists("b:slumlord_bnum") && bufexists(b:slumlord_bnum)
|
||||
if bufwinnr(b:slumlord_bnum) != -1
|
||||
exec bufwinnr(b:slumlord_bnum) . "wincmd w"
|
||||
else
|
||||
exec b:slumlord_bnum . "sb"
|
||||
endif
|
||||
else
|
||||
let prev_bnum = bufnr("")
|
||||
new
|
||||
setlocal buftype=nofile
|
||||
setlocal bufhidden=wipe
|
||||
setlocal noswapfile
|
||||
setlocal textwidth=0 " avoid automatic line break
|
||||
call setbufvar(prev_bnum, "slumlord_bnum", bufnr(""))
|
||||
call self.__setupWinOpts()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function s:WinUpdater.__setupWinOpts() abort
|
||||
setl nowrap
|
||||
setl buftype=nofile
|
||||
syn match plantumlPreviewBoxParts #[┌┐└┘┬─│┴<>╚═╪╝╔═╤╪╗║╧╟╠╣]#
|
||||
syn match plantumlPreviewCtrlFlow #\(LOOP\|ALT\|OPT\)[^│]*│\s*[a-zA-Z0-9?! ]*#
|
||||
syn match plantumlPreviewCtrlFlow #║ \[[^]]*\]#hs=s+3,he=e-1
|
||||
syn match plantumlPreviewEntity #│\w*│#hs=s+1,he=e-1
|
||||
syn match plantumlPreviewTitleUnderline #\^\+#
|
||||
syn match plantumlPreviewNoteText #║[^┌┐└┘┬─│┴<>╚═╪╝╔═╤╪╗║╧╟╠╣]*[░ ]║#hs=s+1,he=e-2
|
||||
syn match plantumlPreviewDividerText #╣[^┌┐└┘┬─│┴<>╚═╪╝╔═╤╪╗║╧╟╣]*╠#hs=s+1,he=e-1
|
||||
syn match plantumlPreviewMethodCall #\(\(│\|^\)\s*\)\@<=[a-zA-Z_]*([[:alnum:],_ ]*)#
|
||||
syn match plantumlPreviewMethodCallParen #[()]# containedin=plantumlPreviewMethodCall contained
|
||||
|
||||
hi def link plantumlPreviewBoxParts normal
|
||||
hi def link plantumlPreviewCtrlFlow Keyword
|
||||
hi def link plantumlPreviewLoopName Statement
|
||||
hi def link plantumlPreviewEntity Statement
|
||||
hi def link plantumlPreviewTitleUnderline Statement
|
||||
hi def link plantumlPreviewNoteText Constant
|
||||
hi def link plantumlPreviewDividerText Constant
|
||||
hi def link plantumlPreviewMethodCall plantumlText
|
||||
hi def link plantumlPreviewMethodCallParen plantumlColonLine
|
||||
endfunction
|
||||
|
||||
|
||||
" other shit {{{1
|
||||
if exists("g:slumlord_separate_win") && g:slumlord_separate_win
|
||||
let s:updater = s:WinUpdater
|
||||
else
|
||||
let s:updater = s:InPlaceUpdater
|
||||
endif
|
||||
|
||||
" Outro {{{1
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:set fdm=marker:
|
31
bundle/vim-slumlord/ftplugin/plantuml.vim
vendored
Normal file
31
bundle/vim-slumlord/ftplugin/plantuml.vim
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
" PlantUML Live Preview for ascii/unicode art
|
||||
" @Author: Martin Grenfell <martin.grenfell@gmail.com>
|
||||
" @Date: 2018-12-07 13:00:22
|
||||
" @Last Modified by: Tsuyoshi CHO <Tsuyoshi.CHO@Gmail.com>
|
||||
" @Last Modified time: 2018-12-08 00:02:43
|
||||
" @License: WTFPL
|
||||
" PlantUML Filetype preview kick
|
||||
|
||||
" Intro {{{1
|
||||
if exists("b:loaded_slumlord")
|
||||
finish
|
||||
endif
|
||||
let b:loaded_slumlord=1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" setting {{{1
|
||||
setlocal nowrap
|
||||
|
||||
" autocmd {{{1
|
||||
augroup slumlord
|
||||
autocmd!
|
||||
autocmd BufWritePre * if &ft =~ 'plantuml' | silent call slumlord#updatePreview({'write': 1}) | endif
|
||||
augroup END
|
||||
|
||||
" Outro {{{1
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:set fdm=marker:
|
BIN
bundle/vim-slumlord/plantuml.jar
vendored
Normal file
BIN
bundle/vim-slumlord/plantuml.jar
vendored
Normal file
Binary file not shown.
31
bundle/vim-slumlord/syntax/plantuml.vim
vendored
Normal file
31
bundle/vim-slumlord/syntax/plantuml.vim
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
" PlantUML Live Preview for ascii/unicode art
|
||||
" @Author: Martin Grenfell <martin.grenfell@gmail.com>
|
||||
" @Date: 2018-12-07 13:00:22
|
||||
" @Last Modified by: Tsuyoshi CHO <Tsuyoshi.CHO@Gmail.com>
|
||||
" @Last Modified time: 2018-12-08 00:02:47
|
||||
" @License: WTFPL
|
||||
" PlantUML Filetype preview syntax
|
||||
|
||||
syn region plantumlPreview start=#\%^\ze\_.*\n@startuml# end=#\ze@startuml#
|
||||
syn match plantumlPreviewBoxParts #[┌┐└┘┬─│┴<>╚═╪╝╔═╤╪╗║╧╟╠╣]# containedin=plantumlPreview contained
|
||||
syn match plantumlPreviewCtrlFlow #\(LOOP\|ALT\|OPT\)[^│]*│\s*[a-zA-Z0-9?! ]*# containedin=plantumlPreview contains=plantumlPreviewBoxParts contained
|
||||
syn match plantumlPreviewCtrlFlow #║ \[[^]]*\]#hs=s+3,he=e-1 containedin=plantumlPreview contained
|
||||
syn match plantumlPreviewEntity #│\w*│#hs=s+1,he=e-1 containedin=plantumlPreview contained
|
||||
syn match plantumlPreviewTitleUnderline #\^\+# containedin=plantumlPreview contained
|
||||
syn match plantumlPreviewNoteText #║[^┌┐└┘┬─│┴<>╚═╪╝╔═╤╪╗║╧╟╠╣]*[░ ]║#hs=s+1,he=e-2 containedin=plantumlPreview contained
|
||||
syn match plantumlPreviewDividerText #╣[^┌┐└┘┬─│┴<>╚═╪╝╔═╤╪╗║╧╟╣]*╠#hs=s+1,he=e-1 containedin=plantumlPreview contained
|
||||
syn match plantumlPreviewMethodCall #\(\(│\|^\)\s*\)\@<=[a-zA-Z_]*([[:alnum:],_ ]*)# containedin=plantumlPreview contained
|
||||
syn match plantumlPreviewMethodCallParen #[()]# containedin=plantumlPreviewMethodCall contained
|
||||
|
||||
hi def link plantumlPreview Normal
|
||||
hi def link plantumlPreviewBoxParts normal
|
||||
hi def link plantumlPreviewCtrlFlow Keyword
|
||||
hi def link plantumlPreviewLoopName Statement
|
||||
hi def link plantumlPreviewEntity Statement
|
||||
hi def link plantumlPreviewTitleUnderline Statement
|
||||
hi def link plantumlPreviewNoteText Constant
|
||||
hi def link plantumlPreviewDividerText Constant
|
||||
hi def link plantumlPreviewMethodCall plantumlText
|
||||
hi def link plantumlPreviewMethodCallParen plantumlColonLine
|
||||
|
||||
" vim: ft=vim
|
Loading…
x
Reference in New Issue
Block a user