Skip to content

Commit b1a632f

Browse files
committed
fix: don't write when writing is disabled globally
writing buffers fails/errors when `write` is false acknowledge and follow nvim's `write` option
1 parent e26d64e commit b1a632f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/sos/impl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ local err
5050
-- when :confirm is used). This flag is set at least on :read and :file. See
5151
-- :h not-edited.
5252
-- * Use ++p flag to auto create parent dirs? Or prompt?
53-
-- * Ensure 'write' is set, otherwise this will prob error with msg!?
5453

5554
---@return nil
5655
local function write_current_buf()
@@ -79,6 +78,7 @@ end
7978
function M.write_buf_if_needed(buf)
8079
if
8180
vim.bo[buf].mod
81+
and vim.o.write
8282
and not vim.bo[buf].ro
8383
and api.nvim_buf_is_loaded(buf)
8484
and wanted_buftype(buf)

0 commit comments

Comments
 (0)