3 ms·
My #1 Vim tip: Use ":set hidden" (Don't rely on ":help hidden" to actually explain it, though.) Here is why you want to use it: You edit "file-a" and make s
by kazinator 9y ago
My #1 Vim tip:
Use ":set hidden"
(Don't rely on ":help hidden" to actually explain it, though.)
Here is why you want to use it:
You edit "file-a" and make some changes. Then you flip to "file-b" using ":e fileb". Vim says you cannot; you have unsaved changes. Okay, so you ":w" and then flip. But then you return to "filea" and want to undo the earlier changes. Oops: lapsing into a dumb Vi from Unix, Vim says there aren't any changes to be undone.
Vim throws away buffers by default when you switch out of them, unless "set :hidden" is turned on. Then it behaves like any other normal application with multiple buffers. The "filea" buffer will stick around and keep its undo history, marks and other state.