Neovim 0.10+
Using your preferred plugin manager, add:
'ellisonleao/carbon-now.nvim'
Example with packer:
use {"ellisonleao/carbon-now.nvim", config = function() require('carbon-now').setup() end}
Example with lazy.nvim:
{
  "ellisonleao/carbon-now.nvim",
  lazy = true,
  cmd = "CarbonNow",
  ---@param opts cn.ConfigSchema
  opts = { [[ your custom config here ]] }
}
The plugin comes with the following default configs:
{
  base_url = "https://carbon.now.sh/",
  options = {
    bg = "gray",
    drop_shadow_blur = "68px",
    drop_shadow = false,
    drop_shadow_offset_y = "20px",
    font_family = "Hack",
    font_size = "18px",
    line_height = "133%",
    line_numbers = true,
    theme = "monokai",
    titlebar = "Made with carbon-now.nvim",
    watermark = false,
    width = "680",
    window_theme = "sharp",
    padding_horizontal = "0px",
    padding_vertical = "0px",
  },
}
You can override it in setup() function. Example:
local carbon = require('carbon-now')
carbon.setup({
  options = {
    theme = "solarized",
    font_family = "Monoid",
  }
})
Adding a custom mapping for generating a new snippet is really easy
vim.keymap.set("v", "<leader>cn", ":CarbonNow<CR>", { silent = true })
But if you preferer a command, visual select the code you want to share and call:
:CarbonNow
:CarbonNow GIST_ID