set listchars=tab:>-,trail:_

I tried to unset the above command this way:

unset listchars=tab:>-,trail:_

But only get:

E492: Not an editor command: unset listchars=tab:>-,trail:_

What's the right way to do this?


This will reset the listchars option to the default:

set listchars&

See the options documentation for more info.

  • will unset listchars= work?
    – gbri
    Jul 18 '11 at 16:20
  • 7
    There's no unset command. For toggleable options, you can do set nooption (example: set paste and set nopaste), but listchars is not toggleable. If you actually want to set listchars to have no value, do: set listchars= Jul 18 '11 at 16:35
  • so set listchars& is the same as set listchars=?
    – gbri
    Jul 19 '11 at 11:04
  • 1
    set listchars& sets it to the default setting that it started with, which is eol:$ Jul 19 '11 at 15:27
  • Handy to know, thanks. Also works for :set rightleft
    – aportr
    Sep 12 '14 at 1:59

There are 3 primary ways to unset a variable. I will use the binary command here for demonstration purposes. One of them should work.

  1. set nobinary
  2. set binary&
  3. set binary!

Remember to reload the file you are working on for the values to apply again using :e

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.