Wednesday, April 18, 2012

Re: existance of :diffoff

Hi,

Bee schrieb:
> I use vim on Mac, Linux, Windows with versions 6 and 7.
>
> :diffoff! works with version 7 but does not exist in version 6.
>
> Currently I do this:
>
> function! DiffOff()
> if v:version < 700
> windo set nodiff foldcolumn=0 noscrollbind nowrap scrollopt-=hor
> else
> diffoff!
> endif
> close
> endf
>
> Is there a way to specifically check for the existence of :diffoff! ?

:echo exists(':diffoff')

> And is this function sufficient?

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

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

No comments: