-
-
Save jvns/a138971c693623e177864aad40a57833 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! TakeScreenshot(name) | |
" Take the screenshot | |
call system('pngpaste static/images/' . a:name . '.png') | |
" Insert the image tag at the current cursor position | |
let l:img_tag = '<img src="/images/' . a:name . '.png">' | |
execute "normal! i" . l:img_tag . "\<Esc>" | |
echo "Screenshot saved and image tag inserted!" | |
endfunction | |
command! -nargs=1 Screenshot call TakeScreenshot(<q-args>) | |
" depends on `pngpaste` | |
" how to run it: `:Screenshot blah` will make `blah.png` and insert the image | |
" if you want to customize it just edit the function! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment