Giter Club home page Giter Club logo

copy-as-format's Introduction

copy-as-format

MELPA

Emacs function to copy buffer locations as GitHub/Slack/JIRA etc... formatted code

copy-as-format demo

Supported Formats/Services

  • AsciiDoc
  • Bitbucket
  • Disqus
  • GitHub
  • GitLab
  • โšฐ HipChat
  • HTML
  • JIRA
  • Markdown
  • MediaWiki
  • Org-mode
  • POD
  • reStructuredText
  • Slack
  • Telegram
  • WhatsApp

Usage

M-x copy-as-format or C-u M-x copy-as-format

Copy the current line or active region and add it to the kill ring as GitHub/Slack/JIRA... formatted code. Format defaults to copy-as-format-default. The buffer will not be modified.

With a prefix argument prompt for the format.

M-x copy-as-format-SERVICE

Where SERVICE is one of the supported services.

It's a good idea to bind these functions to a key sequence:

(global-set-key (kbd "C-c w s") 'copy-as-format-slack)
(global-set-key (kbd "C-c w g") 'copy-as-format-github)

For AsciiDoc customization see copy-as-format-asciidoc-include-file-name and copy-as-format-asciidoc-language-alist.

Adding Formats

Create a format function with a signature of TEXT MULTILINE:

  • TEXT - the text to be formatted
  • MULTILINE - t if TEXT spans multiple lines, otherwise nil

For example:

(defun some-great-format (text multiline)
  (if multiline
      (multiline-format text)
    (single-line-format text)))

Then, add an entry to copy-as-format-format-alist. The key is the format's name and the value is the format function:

(add-to-list 'copy-as-format-format-alist '("great-format" some-great-format))

See Also

copy-as-format's People

Contributors

sshaw avatar mavit avatar syohex avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.