On 3 February 2017 at 10:00, Raphaël Proust <raphlalou_AT_gmail.com> wrote:
> On 2 February 2017 at 17:46, Marc André Tanner <mat_AT_brain-dump.org> wrote:
>> […]
>> * Multi file support is not really well supported:
>>
>> - The X and Y commands currently operate on windows, not files.
>> Meaning that if a file is being displayed in multiple windows
>> a given command will be executed once for every window. This is
>> desired in certain cases (e.g. `:X q` to close all windows without
>> unsaved changes) and unwanted in others (e.g.
>>
>> :X 0i,/* ISC licensed */\n
>>
>> to add a license template to the top of every file).
>
> […]
I re-read the man page (this time all the way through) and realised
that most of this part of my answer didn't make sense in the context
of vis. Here's a revised comment.
So currently `X` is more like vim's `windo`. I use `bufdo` more often,
but there are no background buffers in vis so the situation is a bit
different.
Your use case (closing all the windows) can actually be achieved by
cycling through the buffers and using the `:bdelete` command. This
works because `q` has a special version that applies to all the
windows of the same buffer. This shows a few possible alternatives:
- All appropriate commands have two distinct version: one for window,
one for buffer.
- A wrapper function toggles between the different behaviours (similar
to the `:vertical` command in vim).
- A prefix or suffix to these commands toggles between the different
behaviours (similar to the `!` suffix to toggle behaviour of some
functions).
The functions that would be affected: q/delete, earlier/later,
map-window/unmap-window. Any other?
Cheers,
--
______________
Raphaël Proust
Received on Fri Feb 03 2017 - 15:36:04 CET