Skip to content

Commit 1fd4c27

Browse files
committed
docs: update lua type comments
1 parent 50955ab commit 1fd4c27

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

doc/bufpin.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,29 @@ Functions ~
106106

107107
*bufpin.pin()*
108108
`bufpin.pin`({bufnr})
109+
Pin the current buf or the provided buf.
109110
Parameters ~
110-
{bufnr} `(integer)`
111+
{bufnr} `(integer?)`
111112

112113
*bufpin.unpin()*
113114
`bufpin.unpin`({bufnr})
115+
Unpin the current buf or the provided buf.
114116
Parameters ~
115-
{bufnr} `(integer)`
117+
{bufnr} `(integer?)`
116118

117119
*bufpin.toggle()*
118120
`bufpin.toggle`({bufnr})
121+
Toggle the pin state of the current buf or the provided buf.
119122
Parameters ~
120-
{bufnr} `(integer)`
123+
{bufnr} `(integer?)`
121124

122125
*bufpin.remove()*
123126
`bufpin.remove`({bufnr})
124127
Remove a buf either by deleting it or wiping it out. This function obeys the
125128
config |bufpin.config.remove_with|. Use this function to remove pinned bufs.
129+
When no bufnr is provided, the current buf is attempted to be removed.
126130
Parameters ~
127-
{bufnr} `(integer)`
131+
{bufnr} `(integer?)`
128132

129133
*bufpin.edit_by_index()*
130134
`bufpin.edit_by_index`({index})

lua/bufpin.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ end
182182
--- #tag bufpin-functions
183183
--- Functions ~
184184

185-
---@param bufnr integer
185+
--- Pin the current buf or the provided buf.
186+
---@param bufnr integer?
186187
function bufpin.pin(bufnr)
187188
bufnr = bufnr or vim.fn.bufnr()
188189
if h.should_exclude_buf(bufnr) then
@@ -192,14 +193,16 @@ function bufpin.pin(bufnr)
192193
bufpin.refresh_tabline()
193194
end
194195

195-
---@param bufnr integer
196+
--- Unpin the current buf or the provided buf.
197+
---@param bufnr integer?
196198
function bufpin.unpin(bufnr)
197199
bufnr = bufnr or vim.fn.bufnr()
198200
h.unpin_by_bufnr(bufnr)
199201
bufpin.refresh_tabline()
200202
end
201203

202-
---@param bufnr integer
204+
--- Toggle the pin state of the current buf or the provided buf.
205+
---@param bufnr integer?
203206
function bufpin.toggle(bufnr)
204207
bufnr = bufnr or vim.fn.bufnr()
205208
local bufnr_index = h.table_find_index(h.state.pinned_bufs, bufnr)
@@ -213,8 +216,10 @@ end
213216

214217
--- Remove a buf either by deleting it or wiping it out. This function obeys the
215218
--- 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?
217221
function bufpin.remove(bufnr)
222+
bufnr = bufnr or vim.fn.bufnr()
218223
if bufpin.config.remove_with == "delete" then
219224
h.delete_buf(bufnr)
220225
elseif bufpin.config.remove_with == "wipeout" then
@@ -391,7 +396,6 @@ end
391396
--- Delete a buf, unpinning if necessary and conditionally using mini.bufremove.
392397
---@param bufnr integer
393398
function h.delete_buf(bufnr)
394-
bufnr = bufnr or vim.fn.bufnr()
395399
if vim.bo.modified then
396400
if bufpin.config.use_mini_bufremove then
397401
require("mini.bufremove").delete(bufnr)
@@ -413,7 +417,6 @@ end
413417
--- Wipeout a buf, unpinning if necessary and conditionally using mini.bufremove.
414418
---@param bufnr integer
415419
function h.wipeout_buf(bufnr)
416-
bufnr = bufnr or vim.fn.bufnr()
417420
if vim.bo.modified then
418421
if bufpin.config.use_mini_bufremove then
419422
require("mini.bufremove").wipeout(bufnr)

0 commit comments

Comments
 (0)