Replies: 2 comments 2 replies
-
You can write a plugin that uses the go_os = import("os")
go_io = import("io")
function preSave(bufpane)
local path = bufpane.Buf.AbsPath
local srcfile, err = go_os.Open(path)
local destfile, err = go_os.Create(path .. "~")
local bytesWritten, err = go_io.Copy(destfile, srcfile)
srcfile:Close()
destfile:Close()
end Note that code above doesn't do any error handling at all so you might want to adjust it a little bit (you might have problems if saving the copy would need permissions). |
Beta Was this translation helpful? Give feedback.
2 replies
-
Oh, thank you for your quick reply! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had vim configured to keep an old version of files while saving. In my case it is stored with "~" suffix.
Is there any possibility to do this with micro editor?
Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions