简体   繁体   English

有没有办法让 VSCode 移动到代码的开头(而不是行本身的开头)?

[英]Is there a way to make VSCode move to the start of the code (not the start of the line itself)?

I have CTRL-A bound to "cursorLineStart", but that brings me to the far left of the buffer, generally a multiple levels of indent before the code starts.我将 CTRL-A 绑定到“cursorLineStart”,但这会将我带到缓冲区的最左侧,通常是代码开始前的多级缩进。 Is there a way to make CTRL-A go to the start of the code itself, maybe "first word" or something similar?有没有办法让 CTRL-A go 成为代码本身的开头,也许是“第一个词”或类似的东西? Thanks!谢谢!

Edit: Trying to be more clear.编辑:试图更清楚。 I already have a key bound for "Go to beginning of line" ("cursorLineStart"), what I'm trying to do is intelligently go to the start of the code on that line instead of going to the very beginning and having to move over several levels of indent.我已经有一个键绑定到“转到行首”(“cursorLineStart”),我想做的是智能地 go 到该行代码的开头,而不是转到最开头并且必须移动超过几个级别的缩进。 So go to first non-whitespace on a line.所以 go 到一行中的第一个非空白。

You can view keybinds within VSCode by opening the command palette (CMD + SHIFT + P on a Mac) -> "Preferences: Open Keyboard Shortcuts".您可以通过打开命令面板(在 Mac 上为 CMD + SHIFT + P)->“首选项:打开键盘快捷方式”来查看 VSCode 中的键绑定。 The search on this settings page is really good.这个设置页面上的搜索真的很好。

The behavior you are looking for cursorHome I believe?我相信您正在寻找cursorHome的行为? You can rebind anything here.你可以在这里重新绑定任何东西。

For Windows (not specific to VSCode): Ctrl+Home to go to home and Ctrl+End to go to the end.对于 Windows(不特定于 VSCode): Ctrl+Home到 go 到 home, Ctrl+End到 go 到最后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM