IntelliJ IDEA 中跳转到上一个视图位置(向后/向前导航)的键盘快捷键
我知道 Ctrl+Shift+Backspace 用于转到上次编辑的位置。
但我想跳转到我最近所在的位置,而不一定是我编辑过任何内容的位置。
例如,如果我使用 Ctrl+B 跳转到声明,那么我想返回到跳转之前的位置。
I know Ctrl+Shift+Backspace is used to go to the location of the last edit.
But I want to jump to whichever location I was most recently at, not necessarily one where I edited anything.
For example, if I jumped to a declaration using Ctrl+B, then I want to go back to where I was before jumping.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(20)
Alt + Shift + ←(左箭头)
或
Ctrl + E (< em>最近的文件弹出窗口)。
另请检查:
Ctrl + Shift + E(最近编辑的文件弹出窗口)。
Mac 用户请将 Ctrl 替换为 ⌘(命令),将 Alt 替换为 ⌥(选项)。
更新 在 v12.0 中,它是 Alt + Shift +←(向左箭头) 而不是 Alt< /kbd> + Ctrl + ←(左箭头)。
更新 2 在 v14.1(可能更早)中,它是 Ctrl + [
更新 3 在 IntelliJ IDEA 2016.3 中,它是Ctrl + Alt + ←(左箭头)
更新4 在 IntelliJ IDEA 2018.3 中,它是 Alt + Shift + ←(向左箭头)
更新 5 IntelliJ IDEA 2019.3 是 Ctrl + Alt + ← (向左箭头)
Alt + Shift + ← (Left Arrow)
or
Ctrl + E (Recent Files pop-up).
Also check:
Ctrl + Shift + E (the Recently Edited Files pop-up).
Mac users, replace Ctrl with ⌘ (command) and Alt with ⌥ (option).
Update In v12.0 it's Alt + Shift +← (Left Arrow) instead of Alt + Ctrl + ← (Left Arrow).
Update 2 In v14.1 (and possibly earlier) it's Ctrl + [
Update 3 In IntelliJ IDEA 2016.3 it's Ctrl + Alt + ← (Left Arrow)
Update 4 In IntelliJ IDEA 2018.3 it's Alt + Shift + ← (Left Arrow)
Update 5 In IntelliJ IDEA 2019.3 it's Ctrl + Alt + ← (Left Arrow)
根本问题是窗口管理器使用 Ctrl+Alt+Left 和 Right 来切换工作区和/或用于更改屏幕方向的 OEM 实用程序。
您可以使用以下命令更改分配
文件/设置/键盘映射
然后主菜单/导航
找到后退
和前进
并右键单击添加设置替代调和弦的键盘快捷键
。Alt Graph+Left 和 Alt Graph+Right 对我来说效果很好(IceWM 下 Ubuntu 上的 IDEA 13.1.4 )。
The underlying problem is Ctrl+Alt+Left and Right are used by window managers to switch workspace and/or OEM utilities to change the screen orientation.
You can change the assignments using
File / Settings / Keymap
thenMain Menu / Navigate
findBack
andForward
and right click toAdd Keyboard Shortcut
to set an alternative key chord.Alt Graph+Left and Alt Graph+Right works well for me (IDEA 13.1.4 on Ubuntu under IceWM).
CMD + [ ->转到上一个
CMD + ] ->下一步
==========
对于 OSX,cmd + [ 和 ] 是返回和继续的最佳选择。第四,由于它们离手指很近,可以避免手腕稍微扭转,减少一次按键的次数,非常适合 vim 模式下的用户。
正如OP所要求的,这与 cmd + B 配合得很好,这有助于跳转到方法/变量定义内部/到方法/变量定义,并使用 cmd 立即返回+ [.尝试一下。
CMD + [ -> Go Previous
CMD + ] -> Go Next
==========
For OSX, cmd + [ and ] are the best choices to go back & forth, Since they are found so near to fingers, avoiding you wrist twisting a bit, one keypress lesser, ideal for users in vim mode.
As the OP requested, this works well with cmd + B which facilitates jumping inside/to the method/variable definition and comes back immediately using cmd + [. Give a try.
对于 Ubuntu,Ctrl + Alt + 向左 和 Ctrl + Alt + 正确工作正常。
默认情况下,这些键被分配用于 Ubuntu 的工作区导航。
您需要通过转到:
系统设置> 来禁用它。键盘>快捷方式选项卡>导航
并通过按退格键禁用切换到左侧工作区
和切换到右侧工作区
。或者您可以选择更改 Intellij 本身的快捷方式:
For Ubuntu, Ctrl + Alt + Left and Ctrl + Alt + Right work fine.
By default these keys are assigned for Ubuntu's workspace navigation.
You need to disable that by going to :
System Settings > Keyboard > Shortcuts Tab > Navigation
and disableSwitch to workspace left
andSwitch to workspace right
by pressing Backspace.Or you can choose to change shortcuts in Intellij itself:
问答A 内置于 Intellij ...
CTRL/CMD + SHIFT + A x 2 TYPE 插入符号
Q & A is built into Intellij ...
CTRL/CMD + SHIFT + A x 2 TYPE caret
对于版本 14。在 Mac 上,它是 ⌥(alt) + ⌘ + ←
For version 14. On mac, it is ⌥(alt) + ⌘ + ←
大多数情况下,默认快捷键组合是 Ctrl + Alt + 左/右。 (我使用的是linux版本)
或者你可以有一个工具栏选项。通过查看 -> 启用工具栏工具栏。 左和右箭头也会做同样的事情。如果将鼠标悬停在其上,您还可以看到快捷键组合。
以防万一组合键不起作用(这可能是由于多种原因造成的,例如您正在使用虚拟机等),您可以更改此默认组合键,或者您可以添加额外的组合(例如:对于后退/移动到上一个 Ctrl + Alt + < 或 逗号)。
转到设置->选择键盘映射(在搜索栏中输入键盘映射)-> **编辑器操作 ->搜索
返回
并找到导航选项 -> 根据您的喜好更改设置。Mostly the default shortcut key combination is Ctrl + Alt + Left/Right. (I'm using the linux version)
Or you can have a toolbar option for it. Enable the tool bar by View -> Toolbar. The Left and Right Arrows will do the same. If you hover over it then you can see the shortcut key combination also.
Just in case the key combination is not working (this can be due to several reasons like you are using a virtual machine, etc) you can change this default key combination, or you can add an extra combination (ex: For Back/Move to previous Ctrl + Alt + < or Comma).
Go to Settings -> select keymap (type keymap in the search bar) -> **Editor Actions -> search for
back
and find Navigate options -> change the settings as you prefer.OSX 和 Android Studio 版本:
CMD+ [ 和 CMD+ ]
移动到之前的插入位置。
OSX and Android Studio version:
CMD+ [ and CMD+ ]
to move to the previous carret location.
到目前为止,有很多优秀的答案,它们确实回答了这个问题...但是,如果您不想处理禁用图形驱动程序的设置,或创建新的键盘映射,或通过远程会话(RDP)进行开发或在拦截您的击键的虚拟机中,老式的键盘导航仍然有效。只需执行Alt-N即可调出
Navigate
菜单,然后按B键。请注意,您不要同时按下所有键。所以:
Alt-N等待B
这是我一直使用的,对于OP询问的情况正是如此。
此外,这可能会在任何 IntelliJ 更新中保持不变。
Many excellent answers so far, and they do answer the question...But, if you don't want to have to deal with disabling graphics driver's settings, or creating new keyboard mappings, or are developing through a remote session (RDP) or within a VM that intercepts your keystrokes, good-old keyboard navigation still works. Just do Alt-N to bring up the
Navigate
menu and then hit the B key.Please note that you don't hit all keys at the same time. So:
Alt-N wait B
This is what I use all the time, for exactly the case that the OP asked about.
Also, this will probably hold through any IntelliJ updates.
在 IntellJ 2017.2 中,
Ctrl+[ 和 Ctrl+] 在当前中的先前位置之间导航/em> 文件。
Ctrl+Alt+← 和 Ctrl+Alt+→< /kbd> 在所有文件中的先前位置之间导航。
In IntellJ 2017.2,
Ctrl+[ and Ctrl+] navigate between previous locations in the current file.
Ctrl+Alt+← and Ctrl+Alt+→ navigate between previous locations in all files.
取决于所选的键盘映射。
键盘映射:Mac OS X ⌘ + 左右箭头键
键盘映射: Mac OS X 10.5+ ⌘ + [ / ]
我在 Pycharm 中遇到了类似的问题。要解决此问题,请更改首选项中的键盘映射。
Depends on the Keymap selected.
Keymap: Mac OS X ⌘ + Left Right Arrow Keys
Keymap: Mac OS X 10.5+ ⌘ + [ / ]
I was facing similar problems in Pycharm. To resolve change your Keymap in Preferences.
向后/向前导航
Ctrl + Alt + 向左/向右
Navigate back/forward
Ctrl + Alt + Left/Right
对于 Mac 用户,使用 Command+[ 向后移动,使用 Command+] 向前移动。
For Mac users Use Command+[ for backward and Command+] for forward.
使用以下方法仅使用两个键会更容易:
control + Tab
或
Alt + Left/< kbd>右
Using the following ways using only two keys will be the easier:
control + Tab
or
Alt + Left/Right
您可以使用以下命令返回 2017.3.4
Alt + Left
You can use the below to navigate back in 2017.3.4
Alt + Left
按 Ctrl + Alt + S,然后选择
Keymap
,最后通过输入back< 找到键盘快捷键/code> 右上角搜索栏中的单词。
Press Ctrl + Alt + S then choose
Keymap
and finally find the keyboard shortcut by typeback
word in search bar at the top right corner.Intellij 2021.3.2 基本快捷键
Ctrl+Shift+E = 最近位置
Ctrl+E = 最近的文件
Ctrl+N = 查找类
Ctrl+Alt+B = 导航类
Ctrl+Shift+T = 打开该类的测试类
Intellij 2021.3.2 Basic Shortcuts
Ctrl+Shift+E = Recent Locations
Ctrl+E = Recent Files
Ctrl+N = Find the Class
Ctrl+Alt+B = Navigate the Class
Ctrl+Shift+T = Open the Test Class of the Class
就像 @itsneo 所说,我个人认为 ⌘ + [ 和 ] 在 Mac 上最方便。但如果你来自 Linux 方面,我可以理解。然后您可以使用 ⌘ + alt + ← 或 →。
Like @itsneo said, I personally find ⌘ + [ and ] the most convenient ones on a mac. But I can understand if you come from Linux side of things. Then you can use ⌘ + alt + ← or →.
在版本 2018.1 中,导航的键盘快捷键为 Shift+Alt+Left 或 Right
With version 2018.1 the keyboard short cuts for navigation are Shift+Alt+Left or Right
如果您使用的是 UNIX 操作系统的 Mac 键盘;
control + alt + command + left 或 right 应该可以正常工作。
If you are on a mac keyboard using with UNIX OS;
control + alt + command + left or right should work for sure.