Removing Line Numbers in Vi/Vim Editor

Dec 08, 2025 · Programming · 12 views · 7.8

Keywords: editor | numbers | vi

Abstract: This article explains how to display and remove line numbers in the Vi/Vim text editor using commands such as set nu, set nonu, and set nu!. It provides a step-by-step guide for users to manage line number visibility effectively.

Introduction to Line Numbers in Vi/Vim

Vi and its enhanced version Vim are powerful text editors widely used in programming and system administration. One common feature is the display of line numbers, which can aid in navigation and debugging.

Command to Display Line Numbers

To turn on line numbers, use the command set nu in command-line mode. This is a shorthand for set number.

Command to Remove Line Numbers

To clear line numbers from the display, use the command set nonu, which stands for set nonumber.

Toggling Line Numbers

Alternatively, you can toggle the line number display with set nu!, which toggles between on and off states.

Conclusion

Managing line numbers in Vi/Vim is straightforward with these commands, enhancing the editing experience.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.