Reputation: 444
is it possible to add text to a file, and make vim don't save it ?
To clarify the thing, I'm creating a vim-plugin that would add perfs informations above functions, but I don't want these to be saved.
I thought to "fold" these informations, but it's also saved; I searched on Google but it seems nobody ever tried to don't save a part of his code (as it's a bit nonsense :D).
So if you ever heard of such thing, I would grately appreciate it ! Thanks in advance.
Upvotes: 2
Views: 247
Reputation: 172698
Remember that Vim is a text editor; your feature is closely related to IDEs. Therefore, I can think of only kludges and hacks:
'foldtext'
to add your information (but it would interfere with the regular filetype's folding).'balloonexpr'
.BufWritePre
/ BufWritePost
events, but if the information is only supplementary and should never be persisted, that's unnatural (jumps, searches, etc. would also be affected), and it could break, leaving the text behind.:new
and :setlocal buftype=nofile
; see :help special-buffers
. In that, you can do whatever you want, but it's separate from the original file.Upvotes: 7