Line Numbers are helpful for developers to point the code lines that display vertically inline with code in the Editor.
There are multiple ways we can show or hide line numbers in Intelli IDEA.
following are multiple ways
- Global change: This permanently applies to all files opened in Editor.
- Current Active Editor
How to Show line numbers permanently Code Editor in Intellij IDEA?
This approach applies settings permanently.
For example, If you set it to show line numbers, The files opened in the code editor always show line numbers. Behaviour is the same for reopening IDE also.
Open IntelliJ IDEA editor
Select File > Settings, Opens Settings Popup Window
Select Editor > General > Appearance
Show Line Numbersfor showing line numbers, Uncheck for hiding line numbers
- Next, click on Apply button and close the window
- You will see the line numbers It applies permanently to show or hide line numbers in Code Editor.
How to show or hide line numbers to Current Active Editor
show or hide the line numbers in two ways.
Open file in Code editor
Click the Shift key 2 times, It opens Popup Window
Type “line numbers” in the search box
Show Line NumbersOption
This acts as a toggle option, It hides the line numbers for if enabled, If not enable line numbers. ![Intellij show or hide line numbers in active code editor ](/images/editors/intellij/ active-editor-line-number.png)
This change applies to the currently active window
- Right-click on place(Red Arrow shown) on Code editor
- You will see the screen below
- Select the Show Line Number option to check and uncheck for show and hide line numbers
- It applies to the currently active code editor.
![Intellij enable or disable line numbers in current code editor ](/images/editors/intellij/ active-editor-line-number-toggle.png) This setting is lost once the active editor closes or IDEA is closed.