Skip to content

Commit

Permalink
fix: don't write when writing is disabled globally
Browse files Browse the repository at this point in the history
writing buffers fails/errors when `write` is false

acknowledge and follow nvim's `write` option
  • Loading branch information
tmillr committed Mar 16, 2023
1 parent e26d64e commit b1a632f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/sos/impl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ local err
-- when :confirm is used). This flag is set at least on :read and :file. See
-- :h not-edited.
-- * Use ++p flag to auto create parent dirs? Or prompt?
-- * Ensure 'write' is set, otherwise this will prob error with msg!?

---@return nil
local function write_current_buf()
Expand Down Expand Up @@ -79,6 +78,7 @@ end
function M.write_buf_if_needed(buf)
if
vim.bo[buf].mod
and vim.o.write
and not vim.bo[buf].ro
and api.nvim_buf_is_loaded(buf)
and wanted_buftype(buf)
Expand Down

0 comments on commit b1a632f

Please sign in to comment.