I want to show line number in the editor, thus I use set nu in my vimrc. But when I open the embedded terminal with :ter, there are also line numbers there which I feel not comfortable. How could I switch off the line numbers in the terminal while still keep the line numbers of the editor window ?

  • 1
    doesn't this only happen in terminal normal mode? e.g. while the job is running, no line numbers are shown. In any case, have your tried a TerminalOpen autocommand, e.g. :au TerminalOpen * :set nonu? Sep 13, 2018 at 8:01

1 Answer 1


Thanks the helpful comment provided by Christian Brabandt. The answer is to add a line in the .vimrc:

autocmd TerminalOpen * set nonu
  • 1
    With this command the terminal window will have no line numbers, but when you open a new edit buffer that buffer also has no line numbers. Better to use setlocal like autocmd TerminalOpen * setlocal nonu
    – Quinten
    Mar 2, 2020 at 8:51
  • Note that neovim doesn't declare the TerminalOpen group, and instead declares TermOpen. So for neovim you can use autocmd TermOpen * setlocal nonu Mar 15 at 21:28

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.