Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Anyone knows how to configure vim so that line number can show/hide by F10?

Now I'm typing set nu/nonu,which is not convenient...

share|improve this question

map <F10> :set number! <- Should do the trick (AFAIK, the ! at the end makes it a toggle, instead of an always-on).

EDIT: Apologies, I forgot an important note (which you may have already known, but it was inconsiderate of me to forget): To make this persistent, add this line to your .vimrc file.

Take a look at this page for reference, and this SO question for more.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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