Post selections or buffers to online paste bins. Save the URL to a register, or don't.
- Neovim 0.11+ (may work with older versions).
- A
curlexecutable in your$PATH
Use your package manager.
-- options shown with default values
require("paperplanes").setup({
register = "+",
provider = "0x0.st",
provider_options = {},
notifier = vim.notify or print,
save_history = true
})If you are satisfied with the defaults, you do not need to call setup.
register- Any valid register name (+,a) orfalseto disable.provider- See supported provider below.provider_options- Options passed to the configured provider. See list of providers for accepted options.notifier- Any function that accepts a string for display. Defaults to vim.notify or print.save_history- Record actions to log file whentrue.
The :PP command posts the current buffer or visual selection to the configured
pastebin provider. It also supports additional actions like updating or
deleting pastes, depending on provider capabilities.
Create a paste of the entire current buffer:
:PPCreate a paste of the current visual selection:
:'<,'>PP(Select text in visual mode v/V and press : to enter this form.)
:PP [@<provider>] [action] [key=value ...]@<provider>: (optional) Override the default provider.- See tab-completion for known providers, ex:
@0x0.st.
- See tab-completion for known providers, ex:
action:create: (default) Create a paste using the content of the current buffer or visual selection.update: Update a paste using the content of the current buffer or visual selection.- Not all providers support updating, use tab-completion for available actions.
- Updating pastes is only possible to do from the same instance of neovim that created the paste.
delete: Delete a paste associated with the current buffer.- Not all providers support deletion, use tab-completion for available actions.
- Deleting pastes is only possible to do from the same instance of neovim
that created the paste. You may review the history file
(at
require("paperplanes").history_path()) for tokens required to manually delete an historic paste from a provider.
key=value: (optional) Supply arguments to a provider.- You must provide an action when supplying arguments.
- See tab-completion for known arguments, though any given will be passed on to the best of paperplanes' ability, see your providers documentation.
- You may also override default
provider_options.
paperplanes supports the following providers, see sites for TOS and features. paperplanes is not affiliated with any provider in any manner.
- https://0x0.st (
provider = "0x0.st")expires: hours or unix-epoch.secret: generate longer urls.
- https://paste.rs (
provider = "paste.rs") - https://paste.sr.ht (
provider = "sr.ht")- You must have the sourcehut cli (
hut) installed and authenticated to usepaste.sr.ht.
- You must have the sourcehut cli (
- https://gist.github.com (
provider = "gist")token: Github Personal Access Token (PAT)- If the Github CLI tool (
gh) is installed, a token will be automatically retrieved, otherwise you may specify the token as a string, or a function that returns a string. - The token must have "Read and Write" Gist access.
- If the Github CLI tool (
- https://dpaste.org (
provider = "dpaste.org") - https://ray.so (
provider = "ray.so")paddingcolorsdarkmodebackground- See ray.so for values.
- https://mystb.in (
provider = "mystb.in")secret: access protection password
- termbin.com
command: anetcatcompatible command. Defaults tonc,ncatornetcatif nocommandis specified.host: hostname of a self-hosted instance offiche. Defaults totermbin.comif not specified.port: port of self-hosted instance offiche. Defaults to9999if not specified.
A record of all actions performed is stored in a JSON file, located at
require("paperplanes").history_path() for review or manual operations.
History can be disabled via the save_history option.
Note that the history file may contain potentially sensitive content such as deletion tokens returned from some providers. Authorization tokens (eg: Github PATs) are never stored.
The module paperplanes exposes the following functions for custom integration:
create(source-id, content-string, content-metadata, on-complete, provider-name, provider-options)
update(source-id, content-string, content-metadata, on-complete, provider-name, provider-options)
delete(source-id, on-complete, provider-name, provider-options)
-
source-id: Any string or number value used to indentify a paste source. ThePPcommand uses the buffer-id for example. The samesource-idshould be passed when performingupdateordeleteoperations. Note that the value must only be unique per Neovim instance. -
content-string: A string of paste content. -
content-metadata: A table with the optional keyspath,filename,extensionandfiletype. Values should be strings. -
on-complete: A function that receivesurlon success, ornil, erron an error. -
provider-name: (optional) See providers list, if not given the defaultprovideris used. -
provider-options: (optional) Seeprovider_optionsconfiguration. If not given and theprovider-namematches the default configuredprovider, the defaultprovider_optionsare used, otherwise no options are used.
Building paperplanes requires hotpot.nvim v0.9.7+.
The relevant lua/ files should be built when saving any file inside fnl/.
See CHANGELOG.md.
