182
182
--- #tag bufpin-functions
183
183
--- Functions ~
184
184
185
- --- @param bufnr integer
185
+ --- Pin the current buf or the provided buf.
186
+ --- @param bufnr integer ?
186
187
function bufpin .pin (bufnr )
187
188
bufnr = bufnr or vim .fn .bufnr ()
188
189
if h .should_exclude_buf (bufnr ) then
@@ -192,14 +193,16 @@ function bufpin.pin(bufnr)
192
193
bufpin .refresh_tabline ()
193
194
end
194
195
195
- --- @param bufnr integer
196
+ --- Unpin the current buf or the provided buf.
197
+ --- @param bufnr integer ?
196
198
function bufpin .unpin (bufnr )
197
199
bufnr = bufnr or vim .fn .bufnr ()
198
200
h .unpin_by_bufnr (bufnr )
199
201
bufpin .refresh_tabline ()
200
202
end
201
203
202
- --- @param bufnr integer
204
+ --- Toggle the pin state of the current buf or the provided buf.
205
+ --- @param bufnr integer ?
203
206
function bufpin .toggle (bufnr )
204
207
bufnr = bufnr or vim .fn .bufnr ()
205
208
local bufnr_index = h .table_find_index (h .state .pinned_bufs , bufnr )
213
216
214
217
--- Remove a buf either by deleting it or wiping it out. This function obeys the
215
218
--- config |bufpin.config.remove_with|. Use this function to remove pinned bufs.
216
- --- @param bufnr integer
219
+ --- When no bufnr is provided, the current buf is attempted to be removed.
220
+ --- @param bufnr integer ?
217
221
function bufpin .remove (bufnr )
222
+ bufnr = bufnr or vim .fn .bufnr ()
218
223
if bufpin .config .remove_with == " delete" then
219
224
h .delete_buf (bufnr )
220
225
elseif bufpin .config .remove_with == " wipeout" then
391
396
--- Delete a buf, unpinning if necessary and conditionally using mini.bufremove.
392
397
--- @param bufnr integer
393
398
function h .delete_buf (bufnr )
394
- bufnr = bufnr or vim .fn .bufnr ()
395
399
if vim .bo .modified then
396
400
if bufpin .config .use_mini_bufremove then
397
401
require (" mini.bufremove" ).delete (bufnr )
413
417
--- Wipeout a buf, unpinning if necessary and conditionally using mini.bufremove.
414
418
--- @param bufnr integer
415
419
function h .wipeout_buf (bufnr )
416
- bufnr = bufnr or vim .fn .bufnr ()
417
420
if vim .bo .modified then
418
421
if bufpin .config .use_mini_bufremove then
419
422
require (" mini.bufremove" ).wipeout (bufnr )
0 commit comments