Line Numbers are helpful for developers to point the code lines that display vertically in line with the 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 in 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. Behavior is the same for reopening IDE.
Open IntelliJ IDEA editor
Select File > Settings, Opens Settings Popup Window
Select Editor > General > Appearance
Check
Show Line Numbers
for showing line numbers, Uncheck for hiding line numbers- Next, click on the 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 the Current Active Editor
show or hide the line numbers in two ways.
First Way,
Open the file in the Code editor
Click the Shift key 2 times, It opens the Popup Window
Type “line numbers” in the search box
Select
Show Line Numbers
OptionThis acts as a toggle option, It hides the line numbers 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
Second way,
- 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.