mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 20:29:11 +08:00
chore(plantuml_previewer): update plantuml_previewer
This commit is contained in:
parent
9a33b7f001
commit
d5a0d06272
2
bundle/README.md
vendored
2
bundle/README.md
vendored
@ -97,4 +97,4 @@ This plugins are changed based on a specific version of origin plugin.
|
||||
|
||||
- [`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)
|
||||
- [`weirongxu/plantuml-previewer.vim@1dd4d0f`](https://github.com/weirongxu/plantuml-previewer.vim/tree/1dd4d0f2b09cd80a217f76d82f93830dbbe689b3)
|
||||
|
37
bundle/plantuml-previewer.vim/README.md
vendored
37
bundle/plantuml-previewer.vim/README.md
vendored
@ -1,17 +1,20 @@
|
||||
# Plantuml Previewer Vim
|
||||
|
||||
Vim/NeoVim plugin for preview [PlantUML](http://plantuml.com/)
|
||||
|
||||

|
||||
|
||||
## Dependencies
|
||||
* Java
|
||||
* Graphviz (https://www.graphviz.org/download/)
|
||||
* brew install graphviz
|
||||
* apt-get install graphviz
|
||||
* [open-browser.vim](https://github.com/tyru/open-browser.vim)
|
||||
* [aklt/plantuml-syntax](https://github.com/aklt/plantuml-syntax) (vim syntax file for plantuml)
|
||||
|
||||
- Java
|
||||
- Graphviz (https://www.graphviz.org/download/)
|
||||
- brew install graphviz
|
||||
- apt-get install graphviz
|
||||
- [open-browser.vim](https://github.com/tyru/open-browser.vim)
|
||||
- [aklt/plantuml-syntax](https://github.com/aklt/plantuml-syntax) (vim syntax file for plantuml)
|
||||
|
||||
## Usage
|
||||
|
||||
1. Start editing plantuml file in Vim
|
||||
2. Run `:PlantumlOpen` to open previewer webpage in browser
|
||||
3. Saving plantuml file in Vim, then previewer webpage will refresh
|
||||
@ -19,21 +22,27 @@ Vim/NeoVim plugin for preview [PlantUML](http://plantuml.com/)
|
||||
### Commands
|
||||
|
||||
#### PlantumlOpen
|
||||
|
||||
Open previewer webpage in browser, and watch current buffer
|
||||
|
||||
#### PlantumlStart
|
||||
|
||||
Like `PlantumlOpen`, but won't open in browser
|
||||
|
||||
#### PlantumlStop
|
||||
|
||||
Stop watch buffer
|
||||
|
||||
#### PlantumlSave [filepath] [format]
|
||||
|
||||
Export uml diagram to file path
|
||||
Available formats
|
||||
Available formats
|
||||
|
||||
> png, svg, eps, pdf, vdx, xmi,
|
||||
> scxml, html, txt, utxt, latex
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
:e diagram.puml
|
||||
|
||||
@ -43,7 +52,9 @@ Example:
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
#### `g:plantuml_previewer#plantuml_jar_path`
|
||||
|
||||
Custom plantuml.jar file path
|
||||
|
||||
If plant uml was installed by homebrew, you can add the following code to your `.vimrc` to use the version installed by homebrew:
|
||||
@ -57,15 +68,23 @@ au FileType plantuml let g:plantuml_previewer#plantuml_jar_path = get(
|
||||
```
|
||||
|
||||
#### `g:plantuml_previewer#save_format`
|
||||
|
||||
`:PlantumlSave` default format
|
||||
Default: 'png'
|
||||
|
||||
#### `g:plantuml_previewer#viewer_path`
|
||||
|
||||
Custom plantuml viewer path
|
||||
The plugin will copy viewer to here if the directory does not exist
|
||||
And `tmp.puml` and `tmp.svg` will output to here
|
||||
|
||||
#### `g:plantuml_previewer#debug_mode`
|
||||
|
||||
Debug mode
|
||||
The plugin will print debug message if this is set to `1`
|
||||
Default: 0
|
||||
|
||||
## Related
|
||||
* [vim-slumlord](https://github.com/scrooloose/vim-slumlord)
|
||||
* [previm](https://github.com/kannokanno/previm)
|
||||
|
||||
- [vim-slumlord](https://github.com/scrooloose/vim-slumlord)
|
||||
- [previm](https://github.com/kannokanno/previm)
|
||||
|
@ -6,7 +6,11 @@ let s:base_path = fnameescape(expand("<sfile>:p:h")) . '/..'
|
||||
|
||||
let s:default_jar_path = s:base_path . '/lib/plantuml.jar'
|
||||
|
||||
let s:tmp_path = s:base_path . '/tmp'
|
||||
let s:default_java_path = 'java'
|
||||
|
||||
let s:default_include_path = ''
|
||||
|
||||
let s:tmp_path = (s:is_win ? s:base_path . '/tmp' : '/tmp/plantuml-previewer')
|
||||
|
||||
let s:save_as_script_path = s:base_path . '/script/save-as' . (s:is_win ? '.cmd' : '.sh')
|
||||
|
||||
@ -16,10 +20,8 @@ let s:watched_bufnr = 0
|
||||
|
||||
let s:started = v:false
|
||||
|
||||
let s:java = get(g:, 'plantuml_java_command', 'java')
|
||||
|
||||
function! plantuml_previewer#start() "{{{
|
||||
if !executable(s:java)
|
||||
if !executable(s:java_path())
|
||||
echoerr 'require java command'
|
||||
return v:false
|
||||
endif
|
||||
@ -83,6 +85,7 @@ function! plantuml_previewer#copy_viewer_directory() "{{{
|
||||
call system('xcopy ' . default_viewer_path . ' ' . g:plantuml_previewer#viewer_path . ' /O /X /E /H /K')
|
||||
else
|
||||
call system('cp -r ' . default_viewer_path . ' ' . g:plantuml_previewer#viewer_path)
|
||||
call system('chmod a=rwX ' . g:plantuml_previewer#viewer_path)
|
||||
endif
|
||||
echom 'copy ' . default_viewer_path . ' -> ' . viewer_path
|
||||
endif
|
||||
@ -113,11 +116,25 @@ function! s:viewer_html_path() "{{{
|
||||
return s:viewer_path() . '/index.html'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_debug_mode() "{{{
|
||||
return get(g:, 'plantuml_previewer#debug_mode', 0)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:java_path() "{{{
|
||||
let path = get(g:, 'plantuml_previewer#java_path', 0)
|
||||
return s:is_zero(path) ? s:default_java_path : path
|
||||
endfunction "}}}
|
||||
|
||||
function! s:jar_path() "{{{
|
||||
let path = get(g:, 'plantuml_previewer#plantuml_jar_path', 0)
|
||||
return s:is_zero(path) ? s:default_jar_path : path
|
||||
endfunction "}}}
|
||||
|
||||
function! s:include_path() "{{{
|
||||
let path = get(g:, 'plantuml_previewer#include_path', 0)
|
||||
return s:is_zero(path) ? s:default_include_path : path
|
||||
endfunction "}}}
|
||||
|
||||
function! s:save_format() "{{{
|
||||
return get(g:, 'plantuml_previewer#save_format', 'png')
|
||||
endfunction "}}}
|
||||
@ -130,17 +147,39 @@ function! s:fmt_to_ext(fmt) "{{{
|
||||
return a:fmt == 'latex' ? 'tex' : a:fmt
|
||||
endfunction "}}}
|
||||
|
||||
function! s:print_stdout(lines) "{{{
|
||||
let msg = trim(join(a:lines))
|
||||
if !empty(msg)
|
||||
echomsg msg
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:print_stderr(lines) "{{{
|
||||
let msg = trim(join(a:lines))
|
||||
if !empty(msg)
|
||||
echoerr msg
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:run_in_background(cmd) "{{{
|
||||
if s:Job.is_available()
|
||||
call s:Job.start(a:cmd)
|
||||
if s:is_debug_mode()
|
||||
if s:Job.is_available()
|
||||
call s:Job.start(a:cmd, {'on_stdout': function('s:print_stdout'), 'on_stderr': function('s:print_stderr')})
|
||||
else
|
||||
call s:print_stdout(s:Process.execute(a:cmd))
|
||||
endif
|
||||
else
|
||||
try
|
||||
call s:Process.execute(a:cmd, {
|
||||
\ 'background': 1,
|
||||
\})
|
||||
catch
|
||||
call s:Process.execute(a:cmd)
|
||||
endtry
|
||||
if s:Job.is_available()
|
||||
call s:Job.start(a:cmd)
|
||||
else
|
||||
try
|
||||
call s:Process.execute(a:cmd, {
|
||||
\ 'background': 1,
|
||||
\})
|
||||
catch
|
||||
call s:Process.execute(a:cmd)
|
||||
endtry
|
||||
endif
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
@ -158,7 +197,7 @@ function! plantuml_previewer#refresh(bufnr) "{{{
|
||||
let finial_path = s:viewer_path() . '/tmp.' . image_ext
|
||||
let cmd = [
|
||||
\ s:update_viewer_script_path,
|
||||
\ s:java,
|
||||
\ s:java_path(),
|
||||
\ s:jar_path(),
|
||||
\ puml_src_path,
|
||||
\ s:normalize_path(output_dir_path),
|
||||
@ -167,12 +206,13 @@ function! plantuml_previewer#refresh(bufnr) "{{{
|
||||
\ image_type,
|
||||
\ localtime(),
|
||||
\ s:normalize_path(s:viewer_tmp_js_path()),
|
||||
\ s:include_path(),
|
||||
\ ]
|
||||
call s:run_in_background(cmd)
|
||||
endfunction "}}}
|
||||
|
||||
function! plantuml_previewer#save_as(...) "{{{
|
||||
if !executable('java')
|
||||
if !executable(s:java_path())
|
||||
echoerr 'require java command'
|
||||
return
|
||||
endif
|
||||
@ -198,13 +238,14 @@ function! plantuml_previewer#save_as(...) "{{{
|
||||
call mkdir(fnamemodify(save_path, ':p:h'), 'p')
|
||||
let cmd = [
|
||||
\ s:save_as_script_path,
|
||||
\ s:java,
|
||||
\ s:java_path(),
|
||||
\ s:jar_path(),
|
||||
\ puml_src_path,
|
||||
\ s:normalize_path(output_dir_path),
|
||||
\ s:normalize_path(output_path),
|
||||
\ s:normalize_path(save_path),
|
||||
\ image_type,
|
||||
\ s:include_path(),
|
||||
\ ]
|
||||
call s:run_in_background(cmd)
|
||||
endfunction "}}}
|
||||
|
@ -87,6 +87,11 @@ COMMANDS *plantuml-previewer-interface-commands*
|
||||
-----------------------------------------------------------------------------
|
||||
VARIABLES *plantuml-previewer-interface-variables*
|
||||
|
||||
*g:plantuml_previewer#java_path
|
||||
g:plantuml_previewer#java_path
|
||||
The location of the Java executable.
|
||||
Default: "java"
|
||||
|
||||
*g:plantuml_previewer#plantuml_jar_path*
|
||||
g:plantuml_previewer#plantuml_jar_path
|
||||
plantuml.jar path
|
||||
@ -102,6 +107,18 @@ g:plantuml_previewer#viewer_path
|
||||
Custom plantuml viewer path
|
||||
The plugin will copy viewer to here if the directory does not exist
|
||||
And `tmp.puml` and `tmp.svg` will output to here
|
||||
Default: "~/.plantuml-previewer"
|
||||
|
||||
*g:plantuml_previewer#include_path*
|
||||
g:plantuml_previewer#include_path
|
||||
Extend the include path that plantuml uses to find files included
|
||||
via "!include".
|
||||
Default: ""
|
||||
|
||||
*g:plantuml_previewer#debug_mode*
|
||||
g:plantuml_previewer#debug_mode
|
||||
Debug mode
|
||||
Default: 0
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
BIN
bundle/plantuml-previewer.vim/lib/plantuml.jar
vendored
BIN
bundle/plantuml-previewer.vim/lib/plantuml.jar
vendored
Binary file not shown.
25
bundle/plantuml-previewer.vim/script/save-as.cmd
vendored
25
bundle/plantuml-previewer.vim/script/save-as.cmd
vendored
@ -1,11 +1,20 @@
|
||||
set java_path=%1
|
||||
set jar_path=%2
|
||||
set java=%1
|
||||
shift
|
||||
set jar_path=%1
|
||||
shift
|
||||
|
||||
set puml_src_path=%3
|
||||
set output_dir_path=%4
|
||||
set output_path=%5
|
||||
set save_path=%6
|
||||
set image_type=%7
|
||||
set puml_src_path=%1
|
||||
shift
|
||||
set output_dir_path=%1
|
||||
shift
|
||||
set output_path=%1
|
||||
shift
|
||||
set save_path=%1
|
||||
shift
|
||||
set image_type=%1
|
||||
shift
|
||||
set include_path=%1
|
||||
shift
|
||||
|
||||
"%java_path%" -Dapple.awt.UIElement=true -jar "%jar_path%" "%puml_src_path%" -t%image_type% -o "%output_dir_path%"
|
||||
%java% -Dapple.awt.UIElement=true -Dplantuml.include.path="%include_path%" -jar "%jar_path%" "%puml_src_path%" -t%image_type% -o "%output_dir_path%"
|
||||
copy "%output_path%" "%save_path%"
|
||||
|
17
bundle/plantuml-previewer.vim/script/save-as.sh
vendored
17
bundle/plantuml-previewer.vim/script/save-as.sh
vendored
@ -1,12 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
java_path=$1
|
||||
jar_path=$2
|
||||
java=${1}
|
||||
jar_path=${2}
|
||||
|
||||
puml_src_path=$3
|
||||
output_dir_path=$4
|
||||
output_path=$5
|
||||
save_path=$6
|
||||
image_type=$7
|
||||
puml_src_path=${3}
|
||||
output_dir_path=${4}
|
||||
output_path=${5}
|
||||
save_path=${6}
|
||||
image_type=${7}
|
||||
include_path=${8}
|
||||
|
||||
"$java_path" -Dapple.awt.UIElement=true -jar "$jar_path" "$puml_src_path" -t$image_type -o "$output_dir_path"
|
||||
$java -Dapple.awt.UIElement=true -Djava.awt.headless=true -Dplantuml.include.path="$include_path" -jar "$jar_path" "$puml_src_path" -t$image_type -o "$output_dir_path"
|
||||
cp "$output_path" "$save_path"
|
||||
|
@ -1,15 +1,26 @@
|
||||
set java_path=%1
|
||||
set jar_path=%2
|
||||
set java=%1
|
||||
shift
|
||||
set jar_path=%1
|
||||
shift
|
||||
|
||||
set puml_src_path=%3
|
||||
set output_dir_path=%4
|
||||
set output_path=%5
|
||||
set finial_path=%6
|
||||
set image_type=%7
|
||||
set puml_src_path=%1
|
||||
shift
|
||||
set output_dir_path=%1
|
||||
shift
|
||||
set output_path=%1
|
||||
shift
|
||||
set finial_path=%1
|
||||
shift
|
||||
set image_type=%1
|
||||
shift
|
||||
|
||||
set timestamp=%8
|
||||
set update_js_path=%9
|
||||
set timestamp=%1
|
||||
shift
|
||||
set update_js_path=%1
|
||||
shift
|
||||
set include_path=%1
|
||||
shift
|
||||
|
||||
"%java_path%" -Dapple.awt.UIElement=true -jar "%jar_path%" "%puml_src_path%" -t%image_type% -o "%output_dir_path%"
|
||||
%java% -Dapple.awt.UIElement=true -Dplantuml.include.path="%include_path%" -jar "%jar_path%" "%puml_src_path%" -t%image_type% -o "%output_dir_path%"
|
||||
echo F | xcopy /S /Q /F /Y "%output_path%" "%finial_path%"
|
||||
echo window.updateDiagramURL('%timestamp%') > "%update_js_path%"
|
||||
|
@ -1,17 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
java_path=$1
|
||||
jar_path=$2
|
||||
java=${1}
|
||||
jar_path=${2}
|
||||
|
||||
puml_src_path=$3
|
||||
output_dir_path=$4
|
||||
output_path=$5
|
||||
finial_path=$6
|
||||
image_type=$7
|
||||
puml_src_path=${3}
|
||||
output_dir_path=${4}
|
||||
output_path=${5}
|
||||
finial_path=${6}
|
||||
image_type=${7}
|
||||
|
||||
timestamp=$8
|
||||
update_js_path=$9
|
||||
timestamp=${8}
|
||||
update_js_path=${9}
|
||||
include_path=${10}
|
||||
|
||||
"$java_path" -Dapple.awt.UIElement=true -jar "$jar_path" "$puml_src_path" -t$image_type -o "$output_dir_path"
|
||||
$java -Dapple.awt.UIElement=true -Djava.awt.headless=true -Dplantuml.include.path="$include_path" -jar "$jar_path" "$puml_src_path" -t$image_type -o "$output_dir_path"
|
||||
cp "$output_path" "$finial_path"
|
||||
echo "window.updateDiagramURL('$timestamp')" > "$update_js_path"
|
||||
|
13508
bundle/plantuml-previewer.vim/viewer/package-lock.json
generated
vendored
13508
bundle/plantuml-previewer.vim/viewer/package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@
|
||||
"devDependencies": {
|
||||
"file-loader": "^1.1.11",
|
||||
"node-sass": "^4.13.1",
|
||||
"poi": "^10.1.9",
|
||||
"poi": "^12.10.3",
|
||||
"sass-loader": "^7.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user