Hi,

Bee wrote:
> 
> 
> On Apr 18, 11:13 pm, Jürgen Krämer <[email protected]> wrote:
>>
>> Additionally check if the window is really in diff mode:
>>
>>   function! DiffOff()
>>     if exists(':diffoff') == 2
>>       windo if &diff | set nodiff foldcolumn=0 noscrollbind nowrap 
>> scrollopt-=hor | endif
>>     else
>>       diffoff!
>>     endif
>>     close
>>   endf
> 
> Thank you Jürgen
> 
> I think it better to place the test for &diff first:
> 
>   function! DiffOff()
>     if &diff
>       if exists(':diffoff') == 2
>         windo set nodiff foldcolumn=0 noscrollbind nowrap scrollopt-=hor
>       else
>         diffoff!
>       endif
>       close
>     endif
>   endf

no, better keep it inside the windo command. Your modified version would
only work if you are currently in a window that actually is in diff mode,
while the built-in :diffoff! also works when called from a window that is
not in diff mode. That's because 'diff' is a window-local option.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to