Open jakebrinkmann opened 2 years ago
I have written some code which built on top of this plugin, I thought I would share:
" plantuml-previewer.vim " Output as ASCII art into Vim preview window function! PlantUmlUpdatePreview(bufnr) abort let jar_path = expand('~/.vim/plugged/plantuml-previewer.vim/lib/plantuml.jar') let charset = 'UTF-8' let type = 'utxt' let tmpfname = tempname() let puml_src_path = fnamemodify(bufname(a:bufnr), ':p') let puml_filename = fnamemodify(puml_src_path, ':t:r') let final_path = tmpfname . "/" . puml_filename . "." . type let cmd = "java -Dapple.awt.UIElement=true " \ ."-jar \"". jar_path \ ."\" \"" . puml_src_path \ ."\" -charset ". charset ." -t" . type ." -o ". tmpfname call system(cmd) if v:shell_error != 0 echoerr 'Unable to make diagram' else silent execute "pedit " . final_path endif endfunction augroup plantuml_previewer autocmd! autocmd BufWritePost *.pu,*.uml,*.plantuml,*.puml,*.iuml call PlantUmlUpdatePreview(bufnr('%')) augroup END
As it is, It will open a preview window with the ASCII representation of the diagram.
This is useful for me, because I dont want to jump between different programs. This keeps me inside VIM the whole time.
Maybe we can create a new :PlantumlAsciiOpen command?
:PlantumlAsciiOpen
😁
Yes, PR is welcome.
But have you tried https://github.com/scrooloose/vim-slumlord? that might be the feature you need.
I have written some code which built on top of this plugin, I thought I would share:
As it is, It will open a preview window with the ASCII representation of the diagram.
This is useful for me, because I dont want to jump between different programs. This keeps me inside VIM the whole time.
Maybe we can create a new
:PlantumlAsciiOpen
command?😁