My screenshot workflow

I take screenshots of things quite often while I’m working, but I often need to add a screenshot to some markdown notes in vim. Because I’m using vim I can’t exactly just copy and paste the image right into the editor, so I wrote a little script to help me out.

When I take a screenshot with ctrl + shift + prt sc it automatically is copied to my clipboard, so I wrote a command line script that copies the contents of my clipboard to file, then uploads it to my discourse site, and then adds the url of the image in markdown format back to my clipboard for me to paste into vim.

Here is my script:

xclip -se c -t image/png -o > ~/Pictures/screenshot-$(timestamp).png && upload_screenshot | xclip -sel c