Scratch buffer (`bt=nofile`) support
Couldn't you support scratch buffer (bt=nofile)?
I sometimes use a scratch buffer to put some temporary notes in it. Though, Undotree plugin doesn't work for it.
I found it ignores nofile buffer with some intention.
Fix as below makes scratch buffers supported.
Is it the reason that nofile buffers are often used for plugins' status windows or such?
--- a/autoload/undotree.vim
+++ b/autoload/undotree.vim
@@ -569,8 +569,8 @@ function! s:undotree.Update() abort
if exists('b:isUndotreeBuffer')
return
endif
- if (&bt != '' && &bt != 'acwrite') || (&modifiable == 0) || (mode() != 'n')
- if &bt == 'quickfix' || &bt == 'nofile'
+ if (&bt != '' && &bt != 'acwrite' && &bt != 'nofile') || (&modifiable == 0) || (mode() != 'n')
+ if &bt == 'quickfix'
"Do nothing for quickfix and q:
call s:log("undotree.Update() ignore quickfix")
return
nofile buffers are pretty widely used by plugins to display some non-content information.
I know,
but use case for scratch buffer is also well-know usage, isn't it? (See :help scratch-buffer)
For such plugins' info windows, users do not open UndoTree window purposely. So I suppose supporting scratch buffer is more worthful.
It's quite likely. I agree scratch buffers are also useful but the problem is that it's difficult to distinguish the scratch buffers from other info windows. For instance many users will keep something like NERDTree on a side, and that's nofile buffer. So when the undotree pops up, it has to ignore such buffers, and we can't force users to turn the NERDTree off before using the undotree.
That's said, I think we can make it an option in case users doesn't care about the scenario.