在Visual Studio Code中导航回光标最后位置的快捷键是什么?
当前回答
使用 Alt + ← / →
您可以在Visual Studio代码的键绑定中找到所有快捷键。
其他回答
Mac OS (MacBook Pro):
后面:Ctrl(control) + -(连字符)
后退:Ctrl + Shift + -(连字符)
macOS:
⌘+ U:撤销上次游标操作
您也可以尝试按Ctrl + -。
顺便说一下,所有的快捷键都在macOS的键盘快捷键中。这真的很有用!
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
虽然公认的答案是正确的,但任何使用VS Code的Vim扩展的人都可能会因为向后导航需要你遍历你所做的每一次光标移动而感到沮丧。这将阻止“Go back”在以下用例中正常工作:
进入定义 在定义上戳一段时间(例如,移动光标) 回到第一步。
安装了Vim扩展后,每次光标移动都要做“返回”(对我来说,这已经足够让它几乎无用了!)。
幸运的是,Vim扩展很好地实现了跳转,所以在使用VS Code跳转到一个新位置(即“Go to definition”)后,你可以简单地按CTRL+O返回到之前的跳转位置。
键盘快捷命令为“前进”和“返回”。
在Windows上:
Alt +←...navigate回来
Alt +…向前导航
在Mac:
Ctrl + -…返回
Ctrl + Shift + -…向前导航
在Ubuntu Linux下:
按下ctrl+alt+…navigate to back
Ctrl + Shift + -…向前导航
推荐文章
- 如何在Visual Studio代码中触发参数提示?
- 在VS Code中禁用“Comments are not allowed In JSON”错误
- 使用正则表达式搜索和替换Visual Studio代码
- 如何缩进/格式选择的代码在Visual Studio代码?
- 是否有一种方法可以在Visual Studio中删除一行而不剪切它?
- 如何在Eclipse中只使用键盘去一个错误?
- 你常用的Xcode快捷键有哪些?
- 如何禁用预览文件与点击在vs代码?
- Visual Studio代码更改文件资源管理器托盘的字体大小?
- 如何防止Visual Studio Code总是重新打开以前的文件或文件夹?
- VSCode单引号到双引号自动替换
- 如何删除Visual Studio代码中的重复行?
- 在Eclipse中更改字符串的大小写
- 如何设置每个文件类型的标签大小?
- 我如何添加环境变量启动。VSCode中的json