-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpaperplanes.txt
149 lines (96 loc) · 4.84 KB
/
paperplanes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
*paperplanes* Send snippets to online services
>
/
__ __ __ __ __ __ / __ __ __ __
/ ) / ) / ) /___) / ) / ) / / ) / ) /___) (_ `
/ / (‾‾‾( / / (___ / / / / (‾‾‾( / / (___ (__)
/ / /
/ / /
=====================================================*paperplanes* *paperplanes-toc*
Purpose .................................................... |paperplanes-purpose|
Install & Setup ...................................... |paperplanes-install-setup|
Usage ........................................................ |paperplanes-usage|
Command .................................................... |paperplanes-command|
Functions ................................................ |paperplanes-functions|
post_string .......................................... |paperplanes-post-string|
post_range ............................................ |paperplanes-post-range|
post_selection .................................... |paperplanes-post-selection|
post_buffer .......................................... |paperplanes-post-buffer|
Providers ................................................ |paperplanes-providers|
============================================================ *paperplanes-purpose*
Purpose ~
Send snippets from Neovim to online paste bins.
`paperplanes` provides a `:[range]PP` command, as well as a generalised API.
The `:[range]PP` command automatically sets a register if desired.
====================================================== *paperplanes-install-setup*
Install ~
Use your package manager.
Setup ~
>
require("paperplanes").setup({
register = "+",
provider = "0x0.st",
provider_options = {},
notifier = vim.notify or print,
})
```
- `register` - any valid register name or false
- `provider` - see |paperplanes-providers|
- `provider_options` - passed to selected provider, check provider to know if
you need to use this option. Not all providers are option
aware.
- `notifier` - any function that accepts a string, should show that string in some way.
============================================================== *paperplanes-usage*
Usage ~
`paperplanes` provides one command, `:PP` and a number of functions for mapping.
============================================================ *paperplanes-command*
Command ~
>
:PP -> Post entire current buffer, prints URL and sets desired register.
:[range]PP -> Post selected range, prints URL and sets desired register.
Note: Vim does not allow column specification from the command line, so
[range] is linewise only.
========================================================== *paperplanes-functions*
Functions ~
Note: Functions are provided in `snake_case` and `kebab-case`.
Note: All functions accept a `callback` argument which is called with
`url, nil` or `nil, errors` .
Note: Functions to not automatically print the url or set any registers.
-------------------------------------------------------- *paperplanes-post-string*
`post_string(string, metadata, callback, provider-name, provider-options)`
Post given string.
`content`: string content to post.
`metadata`: file metadata table containing `path`, `filename`, `extension` and
`filetype`.
`callback`: function accepting `url_or_nil, err_or_nil`.
`provider-name`: (optional) any valid provider name, if not given, default
provider is used.
`provider-options`: (optional) table of options for provider. If provider-name
is the same as the default provider, the default options are used.
--------------------------------------------------------- *paperplanes-post-range*
`post_range(buffer, start_pos, end_pos, callback, provider-name, provider-options)`
Post given range.
`start_pos` & `end_pos` may be `line` or `[line, column]` .
`provider-name` and `provider-options` are optional.
----------------------------------------------------- *paperplanes-post-selection*
`post_selection(callback, provider-name, provider-options)`
Post current selection.
`provider-name` and `provider-options` are optional.
-------------------------------------------------------- *paperplanes-post-buffer*
`post_buffer(buffer, callback, provider-name, provider-options)`
Post given buffer.
`buffer` is any valid buffer id.
`provider-name` and `provider-options` are optional.
========================================================== *paperplanes-providers*
Providers ~
`paperplanes` supports the following providers, see sites for TOS and features.
- https://0x0.st
- https://paste.sr.ht
- https://gist.github.com
- https://dpaste.org
- https://paste.rs
- https://ray.so
- https://mystb.in
- http://ix.io (HTTP ONLY)
- http://sprunge.us (HTTP ONLY)
See `fnl/paperplanes/providers/*.fnl` for examples to add your own provider.