在Visual Studio Code中导航回光标最后位置的快捷键是什么?
当前回答
根据Visual Studio Code的Key Bindings中的信息,这对于每个操作系统都是不同的。
工作台配置:
返回:workbench.action.navigateBack Go Forward: workbench.action.navigateForward
Linux:
返回:Ctrl+Alt+- 前进:Ctrl+Shift+-
Mac OS X:
返回:Ctrl + - 前进:Ctrl + Shift(⇧)+ -
窗口:
Go Back to: Alt +⬅️ Go Forward: Alt +➡️
其他回答
虽然公认的答案是正确的,但任何使用VS Code的Vim扩展的人都可能会因为向后导航需要你遍历你所做的每一次光标移动而感到沮丧。这将阻止“Go back”在以下用例中正常工作:
进入定义 在定义上戳一段时间(例如,移动光标) 回到第一步。
安装了Vim扩展后,每次光标移动都要做“返回”(对我来说,这已经足够让它几乎无用了!)。
幸运的是,Vim扩展很好地实现了跳转,所以在使用VS Code跳转到一个新位置(即“Go to definition”)后,你可以简单地按CTRL+O返回到之前的跳转位置。
为了回答你的问题,为了:
窗口使用Alt+←向后导航,Alt+→向前导航。 macOS使用Ctrl+-向后导航,Ctrl+Shift+-向前导航。 Linux使用Ctrl+Alt+-进行后退导航,Ctrl+Shift+-进行前进导航。
您可以在“键盘快捷键编辑器”中找到当前的键绑定。
您甚至可以根据自己的喜好编辑键绑定。
Mac OS (MacBook Pro):
后面:Ctrl(control) + -(连字符)
后退:Ctrl + Shift + -(连字符)
Vscode v1.65添加了一些新命令,用于导航到最后/下一个编辑位置或最后/下一个光标位置。
编辑位置意味着有一个实际的编辑,而游标位置意味着您访问了那个位置,但不一定在那里进行了编辑。
默认情况下,编辑器导航位置将被添加 在编辑器之间导航,但在编辑器内部导航时也是如此(对于 例如,当切换笔记本单元格或更改文本中的选择时 编辑器)。如果你觉得太多的位置被记录,新的 添加了减少位置的命令: 导航位置(例如当使用“转到定义”时) 编辑位置(每当编辑器被更改时,例如在文本编辑器中输入时)
从https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_65.md
光标位置:
Go Forward in Navigation Locations
"workbench.action.navigateForwardInNavigationLocations"
Go Back in Navigation Locations
"workbench.action.navigateBackInNavigationLocations"
Go to Last Navigation Location
// acts like a toggle between current and last cursor location
"workbench.action.navigateToLastNavigationLocation"
Go Previous in Navigation Locations
"workbench.action.navigatePreviousInNavigationLocations"
编辑地点:
Go Forward in Edit Locations
"workbench.action.navigateForwardInEditLocations"
Go Back in Edit Locations
"workbench.action.navigateBackInEditLocations"
Go Previous in Edit Locations
"workbench.action.navigatePreviousInEditLocations"
Go to Last Edit Location
// acts like a toggle between current and last edit location
"workbench.action.navigateToLastEditLocation"
Associated context keys have been added to make assigning keybindings more powerful: canNavigateBackInNavigationLocations: Whether it is possible to go back in navigation locations canNavigateForwardInNavigationLocations: Whether it is possible to go forward in navigation locations canNavigateToLastNavigationLocation: Whether it is possible to go to the last navigation location canNavigateBackInEditLocations: Whether it is possible to go back in edit locations canNavigateForwardInEditLocations: Whether it is possible to go forward in edit locations canNavigateToLastEditLocation: Whether it is possible to go to the last edit location
键盘快捷命令为“前进”和“返回”。
在Windows上:
Alt +←...navigate回来
Alt +…向前导航
在Mac:
Ctrl + -…返回
Ctrl + Shift + -…向前导航
在Ubuntu Linux下:
按下ctrl+alt+…navigate to back
Ctrl + Shift + -…向前导航
推荐文章
- 打开同一目录两次
- 如何从终端/命令行调用VS代码编辑器
- 如何在Visual Studio代码中重置设置?
- 如何将制表符转换为空格,反之亦然,在现有的文件
- 错误:'types'只能在.ts文件中使用- Visual Studio Code使用@ts-check
- Visual Studio Code: .git文件夹/文件隐藏
- 使iTerm以与其他操作系统相同的方式翻译“元键”
- Visual Studio Code:如何调试Python脚本的参数
- 如何在Visual Studio代码中触发参数提示?
- 在VS Code中禁用“Comments are not allowed In JSON”错误
- 使用正则表达式搜索和替换Visual Studio代码
- 如何缩进/格式选择的代码在Visual Studio代码?
- 是否有一种方法可以在Visual Studio中删除一行而不剪切它?
- 如何在Eclipse中只使用键盘去一个错误?
- 你常用的Xcode快捷键有哪些?