From b5ad254cc0c35b850a8bef699230252cb53ab878 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Sat, 4 Apr 2020 16:04:32 +0530 Subject: [PATCH] Easier image naming After pasting, it moves the cursor to `Image` placeholder in `select-mode` which allows and promotes providing an alt name for the embedded image. --- plugin/mdip.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/mdip.vim b/plugin/mdip.vim index 39d0a7e..6a5b64e 100644 --- a/plugin/mdip.vim +++ b/plugin/mdip.vim @@ -131,7 +131,11 @@ function! mdip#MarkdownClipboardImage() " let relpath = SaveNewFile(g:mdip_imgdir, tmpfile) let extension = split(tmpfile, '\.')[-1] let relpath = g:mdip_imgdir . '/' . g:mdip_tmpname . '.' . extension - execute "normal! i![Image](" . relpath . ")" + execute "normal! i![I" + let ipos = getcurpos() + execute "normal! amage](" . relpath . ")" + call setpos('.', ipos) + execute "normal! ve\" endif endfunction