@@ -2,6 +2,48 @@ import { bufnameUnusablePattern, decode, encode } from "./utils.ts";
2
2
3
3
export type BufnameParams = Record < string , string | string [ ] | undefined > ;
4
4
5
+ /**
6
+ * Represent Vim's buffer name
7
+ *
8
+ * The format of the buffer name assumed is like
9
+ *
10
+ * ```text
11
+ * {scheme}://{expr}[;{params}][#{fragment}]
12
+ * ```
13
+ *
14
+ * Where
15
+ *
16
+ * - `{scheme}` is used to distinguish a buffer kind. It contains only alphabet
17
+ * characters.
18
+ * - `{expr}` is used to identify a buffer itself. Unusable characters, semicolons
19
+ * (;), and sharps (#) are replaced with percent-encoded characters.
20
+ * - `{params}` (Optional) is used to add meta information to the buffer name like
21
+ * query parameters of URL. Unusable characters and sharps (#) are replaced with
22
+ * percent-encoded characters.
23
+ * - `{fragment}` (Optional) is used to add a suffix to the buffer name for file
24
+ * type detection or so on. Unusable characters are replaced with percent-encoded
25
+ * characters.
26
+ *
27
+ * For example,
28
+ *
29
+ * ```text
30
+ * denops:///Users/John Titor/test.git
31
+ * βββ¬βββ βββββββββββββ¬βββββββββββββ
32
+ * scheme expr
33
+ *
34
+ * denops:///Users/John Titor/test.git;foo=foo&bar=bar1&bar=bar2
35
+ * βββ¬βββ βββββββββββββ¬βββββββββββββ βββββββββββββ¬ββββββββββββ
36
+ * scheme expr params
37
+ *
38
+ * denops:///Users/John Titor/test.git#README.md
39
+ * βββ¬βββ βββββββββββββ¬βββββββββββββ βββββ¬ββββ
40
+ * scheme expr fragment
41
+ *
42
+ * denops:///Users/John Titor/test.git;foo=foo&bar=bar1&bar=bar2#README.md
43
+ * βββ¬βββ βββββββββββββ¬βββββββββββββ βββββββββββββ¬ββββββββββββ βββββ¬ββββ
44
+ * scheme expr params fragment
45
+ * ```
46
+ */
5
47
export type Bufname = {
6
48
// Scheme part of a buffer name. Note that Vim supports only alphabets in scheme part.
7
49
scheme : string ;
0 commit comments