This is a created article in which the information may have evolved or changed.
I used to use vim to edit the Python code, the folding function is no problem
Later, when I edited the Go code, I found that I saved, collapsed all disappeared , I am puzzled, I infer that it is related to the plugin I use, because I save the time will trigger the GOFMT plug-in format code, but it was lazy did not continue to trace down.
Today, a colleague asked me about the problem of folding in vim, I think again, and then prepare to completely solve this problem, first in Chinese search, no results, are the basic use of vim folding. There is no way to use my crappy English to Google search, sure enough, on GitHub vim-go issues inside found, and then saw the author to solve the problem of the code, and then go to my fmt.vim inside to correspond, found an option!
Simply add the following configuration to the VIMRC configuration file, and you will be able to use the folding as usual.
1