vimstatusline

How can I show the value of a Vim option in the status line


I would like my status line to display wrap/nowrap.

set statusline +=%{execute(':set wrap')}

doesn't work. How do I do this?

Thanks!


Solution

  • Try the following, which works for me:

    set statusline+=%{&wrap?'WRAP':'NO\ WRAP'}
    

    Here, I used &wrap instead of :set wrap to get the current wrap status, and escaped the space \ (if you need one).