1
1
import type { Denops } from "https://deno.land/x/denops_core@v4.0.0/mod.ts" ;
2
2
3
3
/**
4
- * Add a buffer to the buffer list with name {name} (must be a
4
+ * Add a buffer to the buffer list with name ** {name}** (must be a
5
5
* String).
6
- * If a buffer for file {name} already exists, return that buffer
6
+ * If a buffer for file ** {name}** already exists, return that buffer
7
7
* number. Otherwise return the buffer number of the newly
8
- * created buffer. When {name} is an empty string then a new
8
+ * created buffer. When ** {name}** is an empty string then a new
9
9
* buffer is always created.
10
10
* The buffer will not have 'buflisted' set and not be loaded
11
11
* yet. To add some text to the buffer use this:
12
- * let bufnr = bufadd('someName')
13
- * call bufload(bufnr)
14
- * call setbufline(bufnr, 1, ['some', 'text'])
12
+ *
13
+ * let bufnr = bufadd('someName')
14
+ * call bufload(bufnr)
15
+ * call setbufline(bufnr, 1, ['some', 'text'])
16
+ *
15
17
* Returns 0 on error.
16
- * Can also be used as a |method|:
17
- * let bufnr = 'somename'->bufadd()
18
+ * Can also be used as a `method`:
19
+ *
20
+ * let bufnr = 'somename'->bufadd()
18
21
*/
19
22
export async function bufadd (
20
23
denops : Denops ,
@@ -25,29 +28,30 @@ export async function bufadd(
25
28
}
26
29
27
30
/**
28
- * The result is a Number, which is |TRUE| if a buffer called
29
- * {buf} exists.
30
- * If the {buf} argument is a number, buffer numbers are used.
31
- *
31
+ * The result is a Number, which is `TRUE` if a buffer called
32
+ * **{buf}** exists.
33
+ * If the **{buf}** argument is a number, buffer numbers are used.
32
34
* Number zero is the alternate buffer for the current window.
33
- * If the {buf} argument is a string it must match a buffer name
35
+ *
36
+ * If the **{buf}** argument is a string it must match a buffer name
34
37
* exactly. The name can be:
35
38
* - Relative to the current directory.
36
39
* - A full path.
37
40
* - The name of a buffer with 'buftype' set to "nofile".
38
41
* - A URL name.
39
42
* Unlisted buffers will be found.
40
43
* Note that help files are listed by their short name in the
41
- * output of | :buffers| , but bufexists() requires using their
44
+ * output of ` :buffers` , but bufexists() requires using their
42
45
* long name to be able to find them.
43
46
* bufexists() may report a buffer exists, but to use the name
44
- * with a | :buffer| command you may need to use | expand()| . Esp
45
- * for MS-Windows 8.3 names in the form "c:\DOCUME~1"
47
+ * with a ` :buffer` command you may need to use ` expand()` . Esp
48
+ * for MS-Windows 8.3 names in the form ` "c:\DOCUME~1"`
46
49
* Use "bufexists(0)" to test for the existence of an alternate
47
50
* file name.
48
51
*
49
- * Can also be used as a |method|:
50
- * let exists = 'somename'->bufexists()
52
+ * Can also be used as a `method`:
53
+ *
54
+ * let exists = 'somename'->bufexists()
51
55
*
52
56
* Obsolete name: buffer_exists().
53
57
*/
@@ -60,12 +64,13 @@ export async function bufexists(
60
64
}
61
65
62
66
/**
63
- * The result is a Number, which is |TRUE| if a buffer called
64
- * {buf} exists and is listed (has the 'buflisted' option set).
65
- * The {buf} argument is used like with |bufexists()|.
67
+ * The result is a Number, which is `TRUE` if a buffer called
68
+ * **{buf}** exists and is listed (has the 'buflisted' option set).
69
+ * The **{buf}** argument is used like with `bufexists()`.
70
+ *
71
+ * Can also be used as a `method`:
66
72
*
67
- * Can also be used as a |method|:
68
- * let listed = 'somename'->buflisted()
73
+ * let listed = 'somename'->buflisted()
69
74
*/
70
75
export async function buflisted (
71
76
denops : Denops ,
@@ -76,17 +81,18 @@ export async function buflisted(
76
81
}
77
82
78
83
/**
79
- * Ensure the buffer {buf} is loaded. When the buffer name
84
+ * Ensure the buffer ** {buf}** is loaded. When the buffer name
80
85
* refers to an existing file then the file is read. Otherwise
81
86
* the buffer will be empty. If the buffer was already loaded
82
87
* then there is no change. If the buffer is not related to a
83
88
* file the no file is read (e.g., when 'buftype' is "nofile").
84
89
* If there is an existing swap file for the file of the buffer,
85
90
* there will be no dialog, the buffer will be loaded anyway.
86
- * The {buf} argument is used like with | bufexists()| .
91
+ * The ** {buf}** argument is used like with ` bufexists()` .
87
92
*
88
- * Can also be used as a |method|:
89
- * eval 'somename'->bufload()
93
+ * Can also be used as a `method`:
94
+ *
95
+ * eval 'somename'->bufload()
90
96
*/
91
97
export async function bufload (
92
98
denops : Denops ,
@@ -96,12 +102,13 @@ export async function bufload(
96
102
}
97
103
98
104
/**
99
- * The result is a Number, which is |TRUE| if a buffer called
100
- * {buf} exists and is loaded (shown in a window or hidden).
101
- * The {buf} argument is used like with |bufexists()|.
105
+ * The result is a Number, which is `TRUE` if a buffer called
106
+ * **{buf}** exists and is loaded (shown in a window or hidden).
107
+ * The **{buf}** argument is used like with `bufexists()`.
108
+ *
109
+ * Can also be used as a `method`:
102
110
*
103
- * Can also be used as a |method|:
104
- * let loaded = 'somename'->bufloaded()
111
+ * let loaded = 'somename'->bufloaded()
105
112
*/
106
113
export async function bufloaded (
107
114
denops : Denops ,
@@ -115,10 +122,10 @@ export async function bufloaded(
115
122
* The result is the name of a buffer. Mostly as it is displayed
116
123
* by the `:ls` command, but not using special names such as
117
124
* "[No Name]".
118
- * If {buf} is omitted the current buffer is used.
119
- * If {buf} is a Number, that buffer number's name is given.
125
+ * If ** {buf}** is omitted the current buffer is used.
126
+ * If ** {buf}** is a Number, that buffer number's name is given.
120
127
* Number zero is the alternate buffer for the current window.
121
- * If {buf} is a String, it is used as a | file-pattern| to match
128
+ * If ** {buf}** is a String, it is used as a ` file-pattern` to match
122
129
* with the buffer names. This is always done like 'magic' is
123
130
* set and 'cpoptions' is empty. When there is more than one
124
131
* match an empty string is returned.
@@ -131,18 +138,22 @@ export async function bufloaded(
131
138
* Listed buffers are found first. If there is a single match
132
139
* with a listed buffer, that one is returned. Next unlisted
133
140
* buffers are searched for.
134
- * If the {buf} is a String, but you want to use it as a buffer
141
+ * If the ** {buf}** is a String, but you want to use it as a buffer
135
142
* number, force it to be a Number by adding zero to it:
136
- * :echo bufname("3" + 0)
137
- * Can also be used as a |method|:
138
- * echo bufnr->bufname()
143
+ *
144
+ * :echo bufname("3" + 0)
145
+ *
146
+ * Can also be used as a `method`:
147
+ *
148
+ * echo bufnr->bufname()
139
149
*
140
150
* If the buffer doesn't exist, or doesn't have a name, an empty
141
151
* string is returned.
142
- * bufname("#") alternate buffer name
143
- * bufname(3) name of buffer 3
144
- * bufname("%") name of current buffer
145
- * bufname("file2") name of buffer where "file2" matches.
152
+ *
153
+ * bufname("#") alternate buffer name
154
+ * bufname(3) name of buffer 3
155
+ * bufname("%") name of current buffer
156
+ * bufname("file2") name of buffer where "file2" matches.
146
157
*
147
158
* Obsolete name: buffer_name().
148
159
*/
@@ -155,25 +166,33 @@ export async function bufname(
155
166
156
167
/**
157
168
* The result is the number of a buffer, as it is displayed by
158
- * the `:ls` command. For the use of {buf}, see | bufname()|
169
+ * the `:ls` command. For the use of ** {buf}** , see ` bufname()`
159
170
* above.
171
+ *
160
172
* If the buffer doesn't exist, -1 is returned. Or, if the
161
- * {create} argument is present and TRUE, a new, unlisted,
173
+ * ** {create}** argument is present and TRUE, a new, unlisted,
162
174
* buffer is created and its number is returned. Example:
163
- * let newbuf = bufnr('Scratch001', 1)
175
+ *
176
+ * let newbuf = bufnr('Scratch001', 1)
177
+ *
164
178
* Using an empty name uses the current buffer. To create a new
165
- * buffer with an empty name use |bufadd()|.
179
+ * buffer with an empty name use `bufadd()`.
180
+ *
166
181
* bufnr("$") is the last buffer:
167
- * :let last_buffer = bufnr("$")
182
+ *
183
+ * :let last_buffer = bufnr("$")
184
+ *
168
185
* The result is a Number, which is the highest buffer number
169
186
* of existing buffers. Note that not all buffers with a smaller
170
187
* number necessarily exist, because ":bwipeout" may have removed
171
188
* them. Use bufexists() to test for the existence of a buffer.
172
189
*
173
- * Can also be used as a |method|:
174
- * echo bufref->bufnr()
190
+ * Can also be used as a `method`:
191
+ *
192
+ * echo bufref->bufnr()
175
193
*
176
194
* Obsolete name: buffer_number().
195
+ *
177
196
* Obsolete name for bufnr("$"): last_buffer_nr().
178
197
*/
179
198
export async function bufnr (
@@ -185,17 +204,18 @@ export async function bufnr(
185
204
}
186
205
187
206
/**
188
- * The result is a Number, which is the | window-ID| of the first
189
- * window associated with buffer {buf}. For the use of {buf},
190
- * see | bufname()| above. If buffer {buf} doesn't exist or
207
+ * The result is a Number, which is the ` window-ID` of the first
208
+ * window associated with buffer ** {buf}** . For the use of ** {buf}** ,
209
+ * see ` bufname()` above. If buffer ** {buf}** doesn't exist or
191
210
* there is no such window, -1 is returned. Example:
192
211
*
193
- * echo "A window containing buffer 1 is " .. (bufwinid(1))
212
+ * echo "A window containing buffer 1 is " .. (bufwinid(1))
194
213
*
195
214
* Only deals with the current tab page.
196
215
*
197
- * Can also be used as a |method|:
198
- * FindBuffer()->bufwinid()
216
+ * Can also be used as a `method`:
217
+ *
218
+ * FindBuffer()->bufwinid()
199
219
*/
200
220
export async function bufwinid (
201
221
denops : Denops ,
@@ -205,18 +225,19 @@ export async function bufwinid(
205
225
}
206
226
207
227
/**
208
- * Like | bufwinid()| but return the window number instead of the
209
- * | window-ID| .
210
- * If buffer {buf} doesn't exist or there is no such window, -1
228
+ * Like ` bufwinid()` but return the window number instead of the
229
+ * ` window-ID` .
230
+ * If buffer ** {buf}** doesn't exist or there is no such window, -1
211
231
* is returned. Example:
212
232
*
213
- * echo "A window containing buffer 1 is " .. (bufwinnr(1))
233
+ * echo "A window containing buffer 1 is " .. (bufwinnr(1))
234
+ *
235
+ * The number can be used with `CTRL-W_w` and ":wincmd w"
236
+ * `:wincmd`.
214
237
*
215
- * The number can be used with |CTRL-W_w| and ":wincmd w"
216
- * |:wincmd|.
238
+ * Can also be used as a `method`:
217
239
*
218
- * Can also be used as a |method|:
219
- * FindBuffer()->bufwinnr()
240
+ * FindBuffer()->bufwinnr()
220
241
*/
221
242
export async function bufwinnr (
222
243
denops : Denops ,
@@ -226,31 +247,33 @@ export async function bufwinnr(
226
247
}
227
248
228
249
/**
229
- * Return a | List| with the lines starting from {lnum} to {end}
230
- * (inclusive) in the buffer {buf}. If {end} is omitted, a
231
- * | List| with only the line {lnum} is returned.
250
+ * Return a ` List` with the lines starting from ** {lnum}** to ** {end}**
251
+ * (inclusive) in the buffer ** {buf}** . If ** {end}** is omitted, a
252
+ * ` List` with only the line ** {lnum}** is returned.
232
253
*
233
- * For the use of {buf}, see | bufname()| above.
254
+ * For the use of ** {buf}** , see ` bufname()` above.
234
255
*
235
- * For {lnum} and {end} "$" can be used for the last line of the
256
+ * For ** {lnum}** and ** {end}** "$" can be used for the last line of the
236
257
* buffer. Otherwise a number must be used.
237
258
*
238
- * When {lnum} is smaller than 1 or bigger than the number of
239
- * lines in the buffer, an empty | List| is returned.
259
+ * When ** {lnum}** is smaller than 1 or bigger than the number of
260
+ * lines in the buffer, an empty ` List` is returned.
240
261
*
241
- * When {end} is greater than the number of lines in the buffer,
242
- * it is treated as {end} is set to the number of lines in the
243
- * buffer. When {end} is before {lnum} an empty | List| is
262
+ * When ** {end}** is greater than the number of lines in the buffer,
263
+ * it is treated as ** {end}** is set to the number of lines in the
264
+ * buffer. When ** {end}** is before ** {lnum}** an empty ` List` is
244
265
* returned.
245
266
*
246
267
* This function works only for loaded buffers. For unloaded and
247
- * non-existing buffers, an empty | List| is returned.
268
+ * non-existing buffers, an empty ` List` is returned.
248
269
*
249
270
* Example:
250
- * :let lines = getbufline(bufnr("myfile"), 1, "$")
251
271
*
252
- * Can also be used as a |method|:
253
- * GetBufnr()->getbufline(lnum)
272
+ * :let lines = getbufline(bufnr("myfile"), 1, "$")
273
+ *
274
+ * Can also be used as a `method`:
275
+ *
276
+ * GetBufnr()->getbufline(lnum)
254
277
*/
255
278
export async function getbufline (
256
279
denops : Denops ,
@@ -262,33 +285,35 @@ export async function getbufline(
262
285
}
263
286
264
287
/**
265
- * Set line {lnum} to {text} in buffer {buf}. This works like
266
- * | setline()| for the specified buffer.
288
+ * Set line ** {lnum}** to ** {text}** in buffer ** {buf}** . This works like
289
+ * ` setline()` for the specified buffer.
267
290
*
268
291
* This function works only for loaded buffers. First call
269
- * |bufload()| if needed.
292
+ * `bufload()` if needed.
293
+ *
294
+ * To insert lines use `appendbufline()`.
295
+ * Any text properties in **{lnum}** are cleared.
270
296
*
271
- * To insert lines use |appendbufline()|.
272
- * Any text properties in {lnum} are cleared.
273
- * {text} can be a string to set one line, or a list of strings
297
+ * **{text}** can be a string to set one line, or a list of strings
274
298
* to set multiple lines. If the list extends below the last
275
299
* line then those lines are added.
276
300
*
277
- * For the use of {buf}, see | bufname()| above.
301
+ * For the use of ** {buf}** , see ` bufname()` above.
278
302
*
279
- * {lnum} is used like with | setline()| .
280
- * Use "$" to refer to the last line in buffer {buf}.
281
- * When {lnum} is just below the last line the {text} will be
303
+ * ** {lnum}** is used like with ` setline()` .
304
+ * Use "$" to refer to the last line in buffer ** {buf}** .
305
+ * When ** {lnum}** is just below the last line the ** {text}** will be
282
306
* added below the last line.
283
307
*
284
- * When {buf} is not a valid buffer, the buffer is not loaded or
285
- * {lnum} is not valid then 1 is returned. In | Vim9| script an
308
+ * When ** {buf}** is not a valid buffer, the buffer is not loaded or
309
+ * ** {lnum}** is not valid then 1 is returned. In ` Vim9` script an
286
310
* error is given.
287
311
* On success 0 is returned.
288
312
*
289
- * Can also be used as a | method| , the base is passed as the
313
+ * Can also be used as a ` method` , the base is passed as the
290
314
* third argument:
291
- * GetText()->setbufline(buf, lnum)
315
+ *
316
+ * GetText()->setbufline(buf, lnum)
292
317
*/
293
318
export async function setbufline (
294
319
denops : Denops ,
0 commit comments