Skip to content

Commit abe5eca

Browse files
committed
fix(utils): buf_get_name with scratch buffer
1 parent 0452a7d commit abe5eca

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lua/fzf-lua/utils.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,11 +1133,15 @@ function M.nvim_buf_get_name(bufnr, bufinfo)
11331133
end
11341134
local bufname = vim.api.nvim_buf_get_name(bufnr)
11351135
if #bufname == 0 then
1136-
local is_qf = M.buf_is_qf(bufnr, bufinfo)
1137-
if is_qf then
1138-
bufname = is_qf == 1 and "[Quickfix List]" or "[Location List]"
1136+
if vim.bo[bufnr].buftype == "nofile" then
1137+
bufname = "[Scratch]"
11391138
else
1140-
bufname = "[No Name]"
1139+
local is_qf = M.buf_is_qf(bufnr, bufinfo)
1140+
if is_qf then
1141+
bufname = is_qf == 1 and "[Quickfix List]" or "[Location List]"
1142+
else
1143+
bufname = "[No Name]"
1144+
end
11411145
end
11421146
end
11431147
assert(#bufname > 0)

0 commit comments

Comments
 (0)