Dasn wrote:
[...
The exists() is formal way to achieve this, especially when we
writing scripts. But sometimes dirty trick comes handy. e.g.:

:echo exists("+ruler") " -> 1 , has 'ruler'
:echo exists("+noruler") " -> 0, doesn't has 'ruler'?

IIUC, this one will always be zero. If you want an "if" that comes true if 'ruler' is not working, use ":if !exists('+ru')"

:set ruler? " check the 'ruler' option
:set noru? " also check the 'ruler' option.

Your choice. I don't like triggering an error if I don't have to. The advantage of this method, OTOH, is that if the option is working you get its value. And if you want to see where (if anywhere) it was set, use ":verbose set ruler?" or ":verb set ru?". But don't forget the question mark.


Best regards,
Tony.

Reply via email to