fix: set nomodifiable after BufWritePre in ssh adapter (#159)
This commit is contained in:
parent
bfa0e8705e
commit
b61bc9b701
1 changed files with 1 additions and 1 deletions
|
|
@ -382,7 +382,6 @@ end
|
||||||
---@param bufnr integer
|
---@param bufnr integer
|
||||||
M.write_file = function(bufnr)
|
M.write_file = function(bufnr)
|
||||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
vim.bo[bufnr].modifiable = false
|
|
||||||
local url = M.parse_url(bufname)
|
local url = M.parse_url(bufname)
|
||||||
local scp_url = url_to_scp(url)
|
local scp_url = url_to_scp(url)
|
||||||
local tmpdir = fs.join(vim.fn.stdpath("cache"), "oil")
|
local tmpdir = fs.join(vim.fn.stdpath("cache"), "oil")
|
||||||
|
|
@ -391,6 +390,7 @@ M.write_file = function(bufnr)
|
||||||
vim.loop.fs_close(fd)
|
vim.loop.fs_close(fd)
|
||||||
end
|
end
|
||||||
vim.cmd.doautocmd({ args = { "BufWritePre", bufname }, mods = { silent = true } })
|
vim.cmd.doautocmd({ args = { "BufWritePre", bufname }, mods = { silent = true } })
|
||||||
|
vim.bo[bufnr].modifiable = false
|
||||||
vim.cmd.write({ args = { tmpfile }, bang = true, mods = { silent = true, noautocmd = true } })
|
vim.cmd.write({ args = { tmpfile }, bang = true, mods = { silent = true, noautocmd = true } })
|
||||||
local tmp_bufnr = vim.fn.bufadd(tmpfile)
|
local tmp_bufnr = vim.fn.bufadd(tmpfile)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue