1
1
" PlantUML Live Preview for ascii/unicode art
2
+ " @Updater: Ravi Singh
2
3
" @Author: Martin Grenfell <[email protected] >
3
4
" @Date: 2018-12-07 13:00:22
4
5
" @Last Modified by: Tsuyoshi CHO <[email protected] >
7
8
" PlantUML preview plugin core
8
9
9
10
" Intro {{{1
10
- if exists (" g:autoloaded_slumlord " )
11
+ if exists (" g:autoloaded_plantumlit " )
11
12
finish
12
13
endif
13
- let g: autoloaded_slumlord = 1
14
+ let g: autoloaded_plantumlit = 1
14
15
15
16
let s: save_cpo = &cpo
16
17
set cpo &vim
17
18
18
19
" variable {{{1
19
- let g: slumlord_plantuml_jar_path = get (g: , ' slumlord_plantuml_jar_path ' , expand (" <sfile>:p:h" ) . " /../plantuml.jar" )
20
- let g: slumlord_plantuml_include_path = get (g: , ' slumlord_plantuml_include_path ' , expand (" ~/.config/plantuml/include/" ))
21
- let g: slumlord_asciiart_utf = get (g: , ' slumlord_asciiart_utf ' , 1 )
20
+ let g: plantumlit_plantuml_jar_path = get (g: , ' plantumlit_plantuml_jar_path ' , expand (" <sfile>:p:h" ) . " /../plantuml.jar" )
21
+ let g: plantumlit_plantuml_include_path = get (g: , ' plantumlit_plantuml_include_path ' , expand (" ~/.config/plantuml/include/" ))
22
+ let g: plantumlit_asciiart_utf = get (g: , ' plantumlit_asciiart_utf ' , 1 )
22
23
23
24
" function {{{1
24
- function ! slumlord #updatePreview (args ) abort
25
+ function ! plantumlit #updatePreview (args ) abort
25
26
if ! s: shouldInsertPreview ()
26
27
return
27
28
end
@@ -30,16 +31,16 @@ function! slumlord#updatePreview(args) abort
30
31
31
32
let type = ' utxt'
32
33
let ext = ' utxt'
33
- if ! g: slumlord_asciiart_utf
34
+ if ! g: plantumlit_asciiart_utf
34
35
let type = ' txt'
35
36
let ext = ' atxt'
36
37
endif
37
38
38
39
let tmpfname = tempname ()
39
40
call s: mungeDiagramInTmpFile (tmpfname)
40
- let b: slumlord_preview_fname = fnamemodify (tmpfname, ' :r' ) . ' .' . ext
41
+ let b: plantumlit_preview_fname = fnamemodify (tmpfname, ' :r' ) . ' .' . ext
41
42
42
- 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
43
+ let cmd = " java -Dapple.awt.UIElement=true -Dplantuml.include.path=\" " . g: plantumlit_plantuml_include_path ." \" -splash: -jar " . g: plantumlit_plantuml_jar_path ." -charset " . charset ." -t" . type ." " . tmpfname
43
44
44
45
let write = has_key (a: args , ' write' ) && a: args [" write" ] == 1
45
46
if exists (" *jobstart" )
@@ -160,7 +161,7 @@ function! s:InPlaceUpdater.update(args) abort
160
161
let startCol = col (" ." )
161
162
162
163
call self .__deletePreviousDiagram ()
163
- call self .__insertDiagram (b: slumlord_preview_fname )
164
+ call self .__insertDiagram (b: plantumlit_preview_fname )
164
165
call s: addTitle ()
165
166
166
167
call cursor (line (" $" ) - (lastLine - startLine), startCol)
@@ -196,7 +197,7 @@ endfunction
196
197
" WinUpdater object {{{1
197
198
let s: WinUpdater = {}
198
199
function ! s: WinUpdater .update (args ) abort
199
- let fname = b: slumlord_preview_fname
200
+ let fname = b: plantumlit_preview_fname
200
201
call self .__moveToWin ()
201
202
% d
202
203
@@ -215,11 +216,11 @@ function! s:WinUpdater.update(args) abort
215
216
endfunction
216
217
217
218
function s: WinUpdater .__moveToWin () abort
218
- if exists (" b:slumlord_bnum " ) && bufexists (b: slumlord_bnum )
219
- if bufwinnr (b: slumlord_bnum ) != -1
220
- exec bufwinnr (b: slumlord_bnum ) . " wincmd w"
219
+ if exists (" b:plantumlit_bnum " ) && bufexists (b: plantumlit_bnum )
220
+ if bufwinnr (b: plantumlit_bnum ) != -1
221
+ exec bufwinnr (b: plantumlit_bnum ) . " wincmd w"
221
222
else
222
- exec b: slumlord_bnum . " sb"
223
+ exec b: plantumlit_bnum . " sb"
223
224
endif
224
225
else
225
226
let prev_bnum = bufnr (" " )
@@ -228,7 +229,7 @@ function s:WinUpdater.__moveToWin() abort
228
229
setlocal bufhidden = wipe
229
230
setlocal noswapfile
230
231
setlocal textwidth = 0 " avoid automatic line break
231
- call setbufvar (prev_bnum, " slumlord_bnum " , bufnr (" " ))
232
+ call setbufvar (prev_bnum, " plantumlit_bnum " , bufnr (" " ))
232
233
call self .__setupWinOpts ()
233
234
endif
234
235
endfunction
@@ -259,7 +260,7 @@ endfunction
259
260
260
261
261
262
" other shit {{{1
262
- if exists (" g:slumlord_separate_win " ) && g: slumlord_separate_win
263
+ if exists (" g:plantumlit_separate_win " ) && g: plantumlit_separate_win
263
264
let s: updater = s: WinUpdater
264
265
else
265
266
let s: updater = s: InPlaceUpdater
0 commit comments