Skip to content

Instantly share code, notes, and snippets.

@dzzzchhh
Created July 6, 2022 11:54
Show Gist options
  • Save dzzzchhh/792f55ac9b106014d57e7b63ded02bda to your computer and use it in GitHub Desktop.
Save dzzzchhh/792f55ac9b106014d57e7b63ded02bda to your computer and use it in GitHub Desktop.
(defun gist/create-from-region (start end)
(interactive "r")
(setq contents (buffer-substring start end))
(setq new-file-name
(read-string "Enter filename: "))
(setq visibility (ivy-completing-read "Specify gist's visibility: " '("public" "secret")))
(write-region start end new-file-name)
(shell-command (format "gh gist create %s --%s" new-file-name visibility))
(delete-file new-file-name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment