如何在IntelliJ中永久启用行号?

时间:2023-01-17 12:06:21

How can I permanently enable line numbers in IntelliJ IDEA?

如何在IntelliJ IDEA中永久启用行号?

19 个解决方案

#1


1369  

IntelliJ 14.X Onwards

From version 14.0 onwards, the path to the setting dialog is slightly different, a General submenu has been added between Editor and Appearance as shown below

从版本14.0开始,设置对话框的路径略有不同,在编辑器和外观之间添加了一个常规子菜单,如下所示

如何在IntelliJ中永久启用行号?

IntelliJ 8.1.2 - 13.X

From IntelliJ 8.1.2 onwards, this option is in File | Settings1. Within the IDE Settings section of that dialog, you'll find it under Editor | Appearance.

从IntelliJ 8.1.2开始,此选项位于File |中设置1。在该对话框的IDE Settings部分中,您可以在Editor |下找到它出现。

  1. On a Mac, these are named IntelliJ IDEA | Preferences...
  2. 在Mac上,这些名为IntelliJ IDEA |喜好...

如何在IntelliJ中永久启用行号?

#2


345  

The question is obviously well answered already, but since IJ 13 you can enable line numbers in 2 seconds flat:

问题显然已经得到了很好的回答,但是从IJ 13开始,您可以在2秒内启用行号:

  1. Press shift twice
  2. 按两次换班

  3. Type "line number"
  4. 输入“行号”

  5. The option shows in the menu and press enter to enable/disable.
  6. 该选项显示在菜单中,然后按enter键启用/禁用。

如何在IntelliJ中永久启用行号?

Et voila ;)

瞧瞧;)

#3


103  

There's another way, and even quicker (works for me in version 10.5)

还有另一种方式,甚至更快(在10.5版本中适用于我)

Simply right click on the place where the line-numbers should be, and there you'll see a small menu.

只需右键单击行号所在的位置,您就会看到一个小菜单。

then, mark the "Show Line Numbers" option.

然后,标记“显示行号”选项。

如何在IntelliJ中永久启用行号?

Please note that this only works on a per-file basis, however. Enjoy.

请注意,这仅适用于每个文件。请享用。

#4


90  

In Intellij 13 the layout has changed, the Settings button can only be found in File -> Settings and not in the toolbars, and from there you follow the same steps: Editor -> Appearance -> Show line numbers, or search for Line numbers in the Settings search input.如何在IntelliJ中永久启用行号?

在Intellij 13中,布局已更改,“设置”按钮只能在“文件” - >“设置”中找到,而不能在工具栏中找到,并从那里按照相同的步骤操作:编辑器 - >外观 - >显示行号,或搜索行号在“设置”搜索输入中。

#5


71  

Android Studio 1.3.2 and on, IntelliJ 15 and on

Global configuration

File -> Settings -> Editor -> General -> Appearance -> Show line numbers

文件 - >设置 - >编辑器 - >常规 - >外观 - >显示行号

如何在IntelliJ中永久启用行号?


Current editor configuration

First way: View -> Active Editor -> Show Line Numbers (this option will only be available if you previously have clicked into a file of the active editor)

第一种方式:查看 - >活动编辑器 - >显示行号(此选项仅在您之前已单击活动编辑器的文件时可用)

Second way: Right click on the small area between the project's structure and the active editor (that is, the one that you can set breakpoints) -> Show Line Numbers. 如何在IntelliJ中永久启用行号?

第二种方法:右键单击项目结构和活动编辑器之间的小区域(即可以设置断点的那个) - >显示行号。

#6


51  

For InteliJ IDEA 11.0 and above
Goto File --> Settings in the Settings window Editor --> Appearance
and tick Show line numbers check box.

对于InteliJ IDEA 11.0及更高版本的转到文件 - >设置窗口中的设置编辑器 - >外观并勾选显示行号复选框。

如何在IntelliJ中永久启用行号?

#7


30  

IntelliJ 14 (Ubuntu):

IntelliJ 14(Ubuntu):

See: how-do-i-turn-on-line-numbers-permanently-in-intellij-14

Permanently:

File > Settings > Editor > General > Appearance > show line numbers

文件>设置>编辑器>常规>外观>显示行号

如何在IntelliJ中永久启用行号?

For current Editor:

对于当前的编辑:

View > Active Editor > Show Line Numbers

查看>活动编辑器>显示行号

如何在IntelliJ中永久启用行号?

#8


29  

IntelliJ IDEA 15

5 approaches


Global change

  1. File > Settings... > Editor > General > Appearance > Show line numbers

    文件>设置...>编辑器>常规>外观>显示行号

    如何在IntelliJ中永久启用行号?

  2. Hit Shift twice > write "line numbers" > Show Line Numbers (that one that has the toggle) > change the toggle to ON

    按两次Shift键>写“行号”>显示行号(具有切换的那个)>将切换更改为ON

    如何在IntelliJ中永久启用行号?


Change for the Active Editor

  1. Right click on the left side bar > Show Line Numbers

    右键单击左侧栏>显示行号

    如何在IntelliJ中永久启用行号?

  2. Hit Shift twice > write "line" > Show Line Numbers (the line doesn't have the toggle)

    按两次Shift键>写“line”>显示行号(该行没有切换)

    如何在IntelliJ中永久启用行号?

  3. Ctrl + Shift + A > write "Show line" > Active Editor: Show Line Numbers > change the toggle to ON

    Ctrl + Shift + A>写“显示行”>活动编辑器:显示行号>将切换更改为ON

    如何在IntelliJ中永久启用行号?

#9


21  

Ok in intelliJ 14 Ultimate using the Mac version this is it.

在使用Mac版本的intelliJ 14 Ultimate中,这就是它。

IntelliJ Idea > Preferences > Editor > General > Appearance > Show Line Numbers

IntelliJ Idea>首选项>编辑器>常规>外观>显示行号

#10


18  

On IntelliJ 12 on MAC OSX, I had a hard time finding it. The search wouldn't show me the way for some reason. Go to Preferences and under IDE Settings, Editor, Appearance and select 'Show line numbers'

在MAC OSX上的IntelliJ 12上,我很难找到它。搜索不会出于某种原因告诉我。转到“首选项”,然后在“IDE设置”,“编辑器”,“外观”下选择“显示行号”

如何在IntelliJ中永久启用行号?

#11


13  

Android Studio

Go to Android Studio => Preferences => Editor => General => Appearance => set Checked "Show line numbers"

转到Android Studio => Preferences => Editor => General => Appearance => set Checked“Show line numbers”

如何在IntelliJ中永久启用行号?

#12


12  

I just hit this with IdeaVim plugin installed, where even if I set Show Line Numbers, it continued to revert to hiding them.

我刚刚安装了IdeaVim插件,即使我设置了显示行号,它仍然会恢复隐藏它们。

The (forehead-slapping-worthy) solution was:

(前额拍打价值)解决方案是:

:set nu

#13


11  

Hello this is Tim from the FUTURE!!! 2011... For 9.0.4

你好,这是来自未来的蒂姆! 2011 ...对于9.0.4

File > Settings

文件>设置

In the tree view group

在树视图组中

------------IDE Settings ---------

------------ IDE设置---------

Click the Editor [+]

单击编辑器[+]

Select Appearance... Its there.

选择外观...它在那里。

#14


11  

1st way: Go to View => Active Editor => show line numbers

第一种方式:转到View => Active Editor =>显示行号

如何在IntelliJ中永久启用行号?

2nd way Go to Android Studio => Preferences => Editor=> Appearance => set Checked "Show Line Numbers"

第二种方式转到Android Studio =>首选项=>编辑器=>外观=>设置选中“显示行号”

如何在IntelliJ中永久启用行号?

如何在IntelliJ中永久启用行号?

#15


10  

On Mac Intellij 12.1.2 there is no File-Settings:

在Mac Intellij 12.1.2上没有文件设置:

There is an application-name menu item to the left of "File" with a "preferences" menu item:

“文件”左侧有一个应用程序名称菜单项,带有“首选项”菜单项:

如何在IntelliJ中永久启用行号?

and within that is the "Settings" dialog shown by the Windows Intellij.

在其中是Windows Intellij显示的“设置”对话框。

#16


10  

In IntelliJ 14 it has moved again somewhat down the menu.

在IntelliJ 14中,它再次向下移动了菜单。

Now we have it unter Editor -> General -> Appearance

现在我们有它编辑 - >一般 - >外观

如何在IntelliJ中永久启用行号?

#17


8  

Just an update for Android Studio 1.5.1 on Windows:

只是Windows上Android Studio 1.5.1的更新:

Go to File -> Settings -> follow picture 如何在IntelliJ中永久启用行号?

转到文件 - >设置 - >关注图片

#18


7  

On IntelliJ IDEA 2016.1.2

在IntelliJ IDEA 2016.1.2上

Go to Settings > Editor > General > Appearance then check the Show Line number option

转到设置>编辑器>常规>外观,然后选中显示行号选项

如何在IntelliJ中永久启用行号?

#19


6  

I add this response for IntelliJ IDEA 2018.2 - Ultimate.

我为IntelliJ IDEA 2018.2添加了这个响应 - Ultimate。

Using menu

IntelliJ Idea > Preferences > Editor > General > Appearance > Show Line Numbers

IntelliJ Idea>首选项>编辑器>常规>外观>显示行号

如何在IntelliJ中永久启用行号?

Using Shortcuts - First way

使用快捷方式 - 第一种方式

For Windows : Ctrl+Shift+a
For Mac : Cmd+shift+a

对于Windows:Ctrl + Shift + a For Mac:Cmd + shift + a

如何在IntelliJ中永久启用行号?

Using Shortcuts - Seconde way

使用快捷方式 - Seconde方式

Touch Shift twice

触摸Shift两次

如何在IntelliJ中永久启用行号?

These three methods exist since the last 4 versions of Intellij and I think they remain valid for a long time.

自Intellij的最后4个版本以来存在这三种方法,我认为它们长期保持有效。

#1


1369  

IntelliJ 14.X Onwards

From version 14.0 onwards, the path to the setting dialog is slightly different, a General submenu has been added between Editor and Appearance as shown below

从版本14.0开始,设置对话框的路径略有不同,在编辑器和外观之间添加了一个常规子菜单,如下所示

如何在IntelliJ中永久启用行号?

IntelliJ 8.1.2 - 13.X

From IntelliJ 8.1.2 onwards, this option is in File | Settings1. Within the IDE Settings section of that dialog, you'll find it under Editor | Appearance.

从IntelliJ 8.1.2开始,此选项位于File |中设置1。在该对话框的IDE Settings部分中,您可以在Editor |下找到它出现。

  1. On a Mac, these are named IntelliJ IDEA | Preferences...
  2. 在Mac上,这些名为IntelliJ IDEA |喜好...

如何在IntelliJ中永久启用行号?

#2


345  

The question is obviously well answered already, but since IJ 13 you can enable line numbers in 2 seconds flat:

问题显然已经得到了很好的回答,但是从IJ 13开始,您可以在2秒内启用行号:

  1. Press shift twice
  2. 按两次换班

  3. Type "line number"
  4. 输入“行号”

  5. The option shows in the menu and press enter to enable/disable.
  6. 该选项显示在菜单中,然后按enter键启用/禁用。

如何在IntelliJ中永久启用行号?

Et voila ;)

瞧瞧;)

#3


103  

There's another way, and even quicker (works for me in version 10.5)

还有另一种方式,甚至更快(在10.5版本中适用于我)

Simply right click on the place where the line-numbers should be, and there you'll see a small menu.

只需右键单击行号所在的位置,您就会看到一个小菜单。

then, mark the "Show Line Numbers" option.

然后,标记“显示行号”选项。

如何在IntelliJ中永久启用行号?

Please note that this only works on a per-file basis, however. Enjoy.

请注意,这仅适用于每个文件。请享用。

#4


90  

In Intellij 13 the layout has changed, the Settings button can only be found in File -> Settings and not in the toolbars, and from there you follow the same steps: Editor -> Appearance -> Show line numbers, or search for Line numbers in the Settings search input.如何在IntelliJ中永久启用行号?

在Intellij 13中,布局已更改,“设置”按钮只能在“文件” - >“设置”中找到,而不能在工具栏中找到,并从那里按照相同的步骤操作:编辑器 - >外观 - >显示行号,或搜索行号在“设置”搜索输入中。

#5


71  

Android Studio 1.3.2 and on, IntelliJ 15 and on

Global configuration

File -> Settings -> Editor -> General -> Appearance -> Show line numbers

文件 - >设置 - >编辑器 - >常规 - >外观 - >显示行号

如何在IntelliJ中永久启用行号?


Current editor configuration

First way: View -> Active Editor -> Show Line Numbers (this option will only be available if you previously have clicked into a file of the active editor)

第一种方式:查看 - >活动编辑器 - >显示行号(此选项仅在您之前已单击活动编辑器的文件时可用)

Second way: Right click on the small area between the project's structure and the active editor (that is, the one that you can set breakpoints) -> Show Line Numbers. 如何在IntelliJ中永久启用行号?

第二种方法:右键单击项目结构和活动编辑器之间的小区域(即可以设置断点的那个) - >显示行号。

#6


51  

For InteliJ IDEA 11.0 and above
Goto File --> Settings in the Settings window Editor --> Appearance
and tick Show line numbers check box.

对于InteliJ IDEA 11.0及更高版本的转到文件 - >设置窗口中的设置编辑器 - >外观并勾选显示行号复选框。

如何在IntelliJ中永久启用行号?

#7


30  

IntelliJ 14 (Ubuntu):

IntelliJ 14(Ubuntu):

See: how-do-i-turn-on-line-numbers-permanently-in-intellij-14

Permanently:

File > Settings > Editor > General > Appearance > show line numbers

文件>设置>编辑器>常规>外观>显示行号

如何在IntelliJ中永久启用行号?

For current Editor:

对于当前的编辑:

View > Active Editor > Show Line Numbers

查看>活动编辑器>显示行号

如何在IntelliJ中永久启用行号?

#8


29  

IntelliJ IDEA 15

5 approaches


Global change

  1. File > Settings... > Editor > General > Appearance > Show line numbers

    文件>设置...>编辑器>常规>外观>显示行号

    如何在IntelliJ中永久启用行号?

  2. Hit Shift twice > write "line numbers" > Show Line Numbers (that one that has the toggle) > change the toggle to ON

    按两次Shift键>写“行号”>显示行号(具有切换的那个)>将切换更改为ON

    如何在IntelliJ中永久启用行号?


Change for the Active Editor

  1. Right click on the left side bar > Show Line Numbers

    右键单击左侧栏>显示行号

    如何在IntelliJ中永久启用行号?

  2. Hit Shift twice > write "line" > Show Line Numbers (the line doesn't have the toggle)

    按两次Shift键>写“line”>显示行号(该行没有切换)

    如何在IntelliJ中永久启用行号?

  3. Ctrl + Shift + A > write "Show line" > Active Editor: Show Line Numbers > change the toggle to ON

    Ctrl + Shift + A>写“显示行”>活动编辑器:显示行号>将切换更改为ON

    如何在IntelliJ中永久启用行号?

#9


21  

Ok in intelliJ 14 Ultimate using the Mac version this is it.

在使用Mac版本的intelliJ 14 Ultimate中,这就是它。

IntelliJ Idea > Preferences > Editor > General > Appearance > Show Line Numbers

IntelliJ Idea>首选项>编辑器>常规>外观>显示行号

#10


18  

On IntelliJ 12 on MAC OSX, I had a hard time finding it. The search wouldn't show me the way for some reason. Go to Preferences and under IDE Settings, Editor, Appearance and select 'Show line numbers'

在MAC OSX上的IntelliJ 12上,我很难找到它。搜索不会出于某种原因告诉我。转到“首选项”,然后在“IDE设置”,“编辑器”,“外观”下选择“显示行号”

如何在IntelliJ中永久启用行号?

#11


13  

Android Studio

Go to Android Studio => Preferences => Editor => General => Appearance => set Checked "Show line numbers"

转到Android Studio => Preferences => Editor => General => Appearance => set Checked“Show line numbers”

如何在IntelliJ中永久启用行号?

#12


12  

I just hit this with IdeaVim plugin installed, where even if I set Show Line Numbers, it continued to revert to hiding them.

我刚刚安装了IdeaVim插件,即使我设置了显示行号,它仍然会恢复隐藏它们。

The (forehead-slapping-worthy) solution was:

(前额拍打价值)解决方案是:

:set nu

#13


11  

Hello this is Tim from the FUTURE!!! 2011... For 9.0.4

你好,这是来自未来的蒂姆! 2011 ...对于9.0.4

File > Settings

文件>设置

In the tree view group

在树视图组中

------------IDE Settings ---------

------------ IDE设置---------

Click the Editor [+]

单击编辑器[+]

Select Appearance... Its there.

选择外观...它在那里。

#14


11  

1st way: Go to View => Active Editor => show line numbers

第一种方式:转到View => Active Editor =>显示行号

如何在IntelliJ中永久启用行号?

2nd way Go to Android Studio => Preferences => Editor=> Appearance => set Checked "Show Line Numbers"

第二种方式转到Android Studio =>首选项=>编辑器=>外观=>设置选中“显示行号”

如何在IntelliJ中永久启用行号?

如何在IntelliJ中永久启用行号?

#15


10  

On Mac Intellij 12.1.2 there is no File-Settings:

在Mac Intellij 12.1.2上没有文件设置:

There is an application-name menu item to the left of "File" with a "preferences" menu item:

“文件”左侧有一个应用程序名称菜单项,带有“首选项”菜单项:

如何在IntelliJ中永久启用行号?

and within that is the "Settings" dialog shown by the Windows Intellij.

在其中是Windows Intellij显示的“设置”对话框。

#16


10  

In IntelliJ 14 it has moved again somewhat down the menu.

在IntelliJ 14中,它再次向下移动了菜单。

Now we have it unter Editor -> General -> Appearance

现在我们有它编辑 - >一般 - >外观

如何在IntelliJ中永久启用行号?

#17


8  

Just an update for Android Studio 1.5.1 on Windows:

只是Windows上Android Studio 1.5.1的更新:

Go to File -> Settings -> follow picture 如何在IntelliJ中永久启用行号?

转到文件 - >设置 - >关注图片

#18


7  

On IntelliJ IDEA 2016.1.2

在IntelliJ IDEA 2016.1.2上

Go to Settings > Editor > General > Appearance then check the Show Line number option

转到设置>编辑器>常规>外观,然后选中显示行号选项

如何在IntelliJ中永久启用行号?

#19


6  

I add this response for IntelliJ IDEA 2018.2 - Ultimate.

我为IntelliJ IDEA 2018.2添加了这个响应 - Ultimate。

Using menu

IntelliJ Idea > Preferences > Editor > General > Appearance > Show Line Numbers

IntelliJ Idea>首选项>编辑器>常规>外观>显示行号

如何在IntelliJ中永久启用行号?

Using Shortcuts - First way

使用快捷方式 - 第一种方式

For Windows : Ctrl+Shift+a
For Mac : Cmd+shift+a

对于Windows:Ctrl + Shift + a For Mac:Cmd + shift + a

如何在IntelliJ中永久启用行号?

Using Shortcuts - Seconde way

使用快捷方式 - Seconde方式

Touch Shift twice

触摸Shift两次

如何在IntelliJ中永久启用行号?

These three methods exist since the last 4 versions of Intellij and I think they remain valid for a long time.

自Intellij的最后4个版本以来存在这三种方法,我认为它们长期保持有效。