Command In All Buffers

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Command In All Buffers

Paul-433
I actually want to set up vim -d or vimdiff with all buffers having wrap on,
but this doesn't work, in ~/.vimrc:

if &diff
     set wrap
endif

Neither does it work when I substitute "windo set wrap". Should that work or do
you think I have some conflicting settings somewhere?

":windo set wrap" works when I already have the buffers open.

--

.
Reply | Threaded
Open this post in threaded view
|

Re: Command In All Buffers

A.J.Mechelynck
Vigil wrote:

> I actually want to set up vim -d or vimdiff with all buffers having wrap
> on, but this doesn't work, in ~/.vimrc:
>
> if &diff
>     set wrap
> endif
>
> Neither does it work when I substitute "windo set wrap". Should that
> work or do you think I have some conflicting settings somewhere?
>
> ":windo set wrap" works when I already have the buffers open.
>

Starting vimdiff automatically sets 'wrap' off (see ":help vimdiff").
This is intentional because otherwise lines of differing length might
cause the diffs to get out of sync.

You might want to do something like (untested)

        autocmd BufRead,BufNewFile * if &diff | setl wrap | endif

(Using ":setlocal" here, rather than ":set", avoids interference with
non-diff buffers loaded in parallel).

However, be prepared to re-sync your buffer (for instance by scrolling
the not-currently-active buffer with the mouse) oftener than without
this option.


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: Command In All Buffers

Eric Arnold
In reply to this post by Paul-433

Setting it in your vimrc doesn't work because the buffers aren't open
yet, but you seem to know that.  This is going to apply no matter what
you do.  Try

    gvim -c 'windo set wrap' -d file1 file2

which runs the command given to -c after the files are loaded.

--- Vigil <[hidden email]> wrote:

> I actually want to set up vim -d or vimdiff with all buffers having wrap on,
> but this doesn't work, in ~/.vimrc:
>
> if &diff
>      set wrap
> endif
>
> Neither does it work when I substitute "windo set wrap". Should that work or
> do
> you think I have some conflicting settings somewhere?
>
> ":windo set wrap" works when I already have the buffers open.
>
> --
>
> .
>

Reply | Threaded
Open this post in threaded view
|

Re: Command In All Buffers

Paul-433
On Tue, 7 Jun 2005, Eric Arnold wrote:

>    gvim -c 'windo set wrap' -d file1 file2

Ah, the one combination that I didn't try, works. Thanks.

--

.