Closed ycycyyc closed 1 year ago
By default nvim doesn't automatically reload files that have been changed externally. You can make it do that with a simple auto command:
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold" }, {
-- Automatically reload file if it's been changed externally.
command = "silent! checktime %",
})
Thank you for your reply!
Description
When I use DiffViewOpen to open the panel, and then want to roll back the modification through restore_entry, the corresponding file is not reloaded.
Expected behavior
Like the vim-fugitive plugin, pressing the X key can roll back the modification of the file and take effect immediately.
Actual behavior
File modifications are not rolled back.
Steps to reproduce
import "fmt"
func main() { fmt.Println("hello") }
package main
import "fmt"
func main() { // new line here fmt.Println("hello") }
WARNING: The file has been changed since reading it!!! Do you really want to write to it (y/n)?
#######################
PUT OUTPUT HERE
#######################
############################
PUT LOG CONTENT HERE
############################
Operating system and version
Darwin 22.5.0 arm64
Minimal config