I was wondering if there is a way to lock a window such that the
content can only be changed by scripting/commands. Like a preview
window or somthing like that.
is that possible to make in Vim or should I make a feature request to
get it :-)
Well, as an atrocious hack, assuming you have a filename assigned
to this given window (no_touch.txt), you could do something like
:au WinEnter no_touch.txt wincmd x
(which kinda pushes the "locked" window out of the way by
preventing you from entering it) or
:au WinEnter no_touch.txt wincmd p
which simply prevents you from entering the window unless/until
it's the last window available.
Beware of crazy behavior that might ensue from this. It would
serve well for either of these to remember that one can prefix
window-selection commands with a count, so you can do
^W2k
to move up *two* windows rather than one, so that you can jump
over the offending "locked" window if needed.
Just a long day here...experiment, have fun, and hopefully it
will give you some crazy ideas too. :)
-tim