CCC
CCC

Reputation: 2242

how detect vim enable certain feature? such as set nu

I wanna a function to detect whether VIM has enabled 'set nu' feature. How do I make the script? Kindly indicate me which resource in 'help' if possible.

Thanks

Upvotes: 1

Views: 155

Answers (2)

Herbert Sitz
Herbert Sitz

Reputation: 22226

:h 'number' will bring it up in help.

:let x = &number
" x will be 1 if set number is on
" x will be 0 if set number is off
:echo &number  "will print value

Upvotes: 4

johnsyweb
johnsyweb

Reputation: 141810

To determine whether 'number' is set, use the ? to query:

:set nu?

To determine from where it was set last:

:verbose set nu?

For more information on options, see:

Upvotes: 6

Related Questions