Skip to content

Conversation

jdorel
Copy link

@jdorel jdorel commented Sep 29, 2021

Use final_imgdir and final_imgdir_intext to support multiple files
Rework SafeMakeDir to not call any global variables

Fix #50 not working when editing multiple files

Use final_imgdir and final_imgdir_intext to support multiple files
Rework SafeMakeDir to not call any global variables
./img/{current_file_name}/
@Wadekiny
Copy link

When opening vim, the .vimrc file will be run once, and g:mdip_imgdir will only be set once.
But opening a new buffer in vim doesn't reset g:mdip_imgdir, so g:mdip_imgdir remains unchanged, causing this problem. My solution is this:

add codes in .vimrc

function! MdPasteImage() 
    let g:mdip_imgdir_intext = './md_images_' . expand('%:r')
    let g:mdip_imgdir = './md_images_' . expand('%:r')
    "echo g:mdip_imgdir
    "echo g:mdip_imgdir_intext
    call mdip#MarkdownClipboardImage()

endfunction

autocmd FileType markdown nmap <buffer><silent> <leader>p :call MdPasteImage()<CR>


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants