Only save telekasten buffers

This commit is contained in:
lambtho12
2022-01-20 11:27:52 +01:00
parent 0e00cafafa
commit 743479b5b9

View File

@@ -1470,13 +1470,18 @@ local function RenameNote()
local newlink = "\\[\\[" .. newname local newlink = "\\[\\[" .. newname
-- Save all open buffers before looking for links to replace -- Save all open buffers before looking for links to replace
if #(vim.fn.getbufinfo({ buflisted = 1 })) > 1 then if #(vim.fn.getbufinfo({ bufmodified = 1 })) > 1 then
local answer = vim.fn.input( local answer = vim.fn.input(
"Telekasten.nvim: Save all current buffers before updating links? [Y/n]" "Telekasten.nvim:"
.. "Save all telekasten buffers before updating links? [Y/n]"
) )
answer = vim.fn.trim(answer) answer = vim.fn.trim(answer)
if answer ~= "n" and answer ~= "N" then if answer ~= "n" and answer ~= "N" then
vim.cmd("wa") for i = 1, vim.fn.bufnr("$") do
if vim.fn.getbufvar(i, "&filetype") == "telekasten" then
vim.cmd(i .. "bufdo w")
end
end
end end
end end