Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F132048
buffers.lua
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
buffers.lua
View Options
local
libivy
=
require
"ivy.libivy"
local
utils
=
require
"ivy.utils"
local
function
items
(
input
)
local
list
=
{}
local
buffers
=
vim
.
api
.
nvim_list_bufs
()
for
index
=
1
,
#
buffers
do
local
buffer
=
buffers
[
index
]
-- Get the relative path from the current working directory. We need to
-- substring +2 to remove the `/` from the start of the path to give us a
-- true relative path
local
buffer_name
=
vim
.
api
.
nvim_buf_get_name
(
buffer
):
sub
(
#
vim
.
fn
.
getcwd
()
+
2
,
-
1
)
local
file_type
=
vim
.
api
.
nvim_buf_get_option
(
buffer
,
"filetype"
)
if
vim
.
api
.
nvim_buf_is_loaded
(
buffer
)
and
file_type
~=
"ivy"
and
#
buffer_name
>
0
then
local
score
=
libivy
.
ivy_match
(
input
,
buffer_name
)
if
score
>
-
200
or
#
input
==
0
then
table.insert
(
list
,
{
score
=
score
,
content
=
buffer_name
})
end
end
end
table.sort
(
list
,
function
(
a
,
b
)
return
a
.
score
<
b
.
score
end
)
return
list
end
local
buffers
=
{
name
=
"Buffers"
,
command
=
"IvyBuffers"
,
description
=
"List all of the current open buffers"
,
keymap
=
"<leader>b"
,
items
=
items
,
callback
=
utils
.
file_action
(),
}
return
buffers
File Metadata
Details
Attached
Mime Type
text/x-Algol68
Expires
Apr 6 2026, 6:58 PM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10588
Default Alt Text
buffers.lua (1 KB)
Attached To
Mode
R1 ivy.nvim
Attached
Detach File
Event Timeline
Log In to Comment