@@ -89,6 +89,11 @@ function! s:SaveFileTMPLinux(imgdir, tmpname) abort
8989endfunction
9090
9191function ! s: SaveFileTMPWin32 (imgdir, tmpname) abort
92+ let shell_bak = &shell
93+ let shellcmdflag_bak = &shellcmdflag
94+ let &shell = ' cmd.exe'
95+ let &shellcmdflag = ' /s /c'
96+
9297 let tmpfile = a: imgdir . ' \' . a: tmpname . ' .png'
9398 let tmpfile = substitute (tmpfile, ' \\ ' , ' ' , ' g' )
9499
@@ -99,6 +104,10 @@ function! s:SaveFileTMPWin32(imgdir, tmpname) abort
99104 let clip_command = " powershell -nologo -noprofile -noninteractive -sta \" " .clip_command. " \" "
100105
101106 silent call system (clip_command)
107+
108+ let &shell = shell_bak
109+ let &shellcmdflag = shellcmdflag_bak
110+
102111 if v: shell_error == 1
103112 return 1
104113 else
@@ -194,7 +203,7 @@ function! g:LatexPasteImage(relpath)
194203endfunction
195204
196205function ! g: EmptyPasteImage (relpath)
197- execute " normal! i" . a: relpath
206+ execute " normal! i" . a: relpath
198207endfunction
199208
200209let g: PasteImageFunction = ' g:MarkdownPasteImage'
@@ -228,7 +237,8 @@ function! mdip#MarkdownClipboardImage()
228237 else
229238 " let relpath = s:SaveNewFile(g:mdip_imgdir, tmpfile)
230239 let extension = split (tmpfile, ' \.' )[-1 ]
231- let relpath = g: mdip_imgdir_intext . ' /' . g: mdip_tmpname . ' .' . extension
240+ let sep = has (' win32' ) ? ' \' : ' /'
241+ let relpath = g: mdip_imgdir_intext . sep . g: mdip_tmpname . ' .' . extension
232242 if call (get (g: , ' PasteImageFunction' ), [relpath])
233243 return
234244 endif
0 commit comments