如何在VS Code中水平移动列块?

huangapple go评论54阅读模式
英文:

How Do I Shift a Column Block Horizontally in VS Code?

问题

I’m pretty new at VS Code. I have version 1.79 on Windows 10.

我对VS Code还不太熟悉。我在Windows 10上使用的是版本1.79。

I’m trying to shift a selected column block horizontally, but haven’t succeeded so far. To be clear, I am not trying to change indentation. The column block (comment text) already has code text to its left. I want to shift the column block to the right to align it with other comments.

我正在尝试水平移动所选的列块,但迄今为止还没有成功。清楚地说,我是在尝试更改缩进。列块(注释文本)左边已经有代码文本。我想将列块向移动,以与其他注释对齐。

Couldn’t find anything in VS Code keybindings about it. Apparently this question has been asked before, but none of the keystroke combinations I saw in other threads worked for me.

在VS Code的键绑定中找不到相关内容。显然,此问题以前已经被提出过,但我在其他帖子中看到的键盘组合都不适用于我。

I Googled the topic, but all the Web sites’ instructions are either years (and versions) old, or they tell you how to select a column block, but not how to move one. I didn’t find the topic in Microsoft’s VS Code FAQ, either.

我在Google上搜索了这个话题,但所有网站的说明要么是多年前(和旧版本),要么是告诉您如何选择列块,而不是如何移动它。在Microsoft的VS Code常见问题中也没有找到这个话题。

I did find one site that said that Ctrl-Shift-Alt-Right would move a selected column block to the right, but it didn’t do anything.

确实找到一个网站,上面说Ctrl-Shift-Alt-Right会将所选的列块向右移动,但它什么都没做。

Would be very grateful if someone could point me in the right direction.

如果有人能指导我正确的方法,我会非常感激。

This picture shows what I’m trying to shift:

这张图片显示了我想要移动的内容:

如何在VS Code中水平移动列块?

如何在VS Code中水平移动列块?

英文:

I’m pretty new at VS Code. I have version 1.79 on Windows 10.

I’m trying to shift a selected column block horizontally, but haven’t succeeded so far. To be clear, I am not trying to change indentation. The column block (comment text) already has code text to its left. I want to shift the column block to the right to align it with other comments.

Couldn’t find anything in VS Code keybindings about it. Apparently this question has been asked before, but none of the keystroke combinations I saw in other threads worked for me.

I Googled the topic, but all the Web sites’ instructions are either years (and versions) old, or they tell you how to select a column block, but not how to move one. I didn’t find the topic in Microsoft’s VS Code FAQ, either.

I did find one site that said that Ctrl-Shift-Alt-Right would move a selected column block to the right, but it didn’t do anything.

Would be very grateful if someone could point me in the right direction.

This picture shows what I’m trying to shift:

如何在VS Code中水平移动列块?

答案1

得分: 1

使用多光标编辑,并将光标放在您当前选择的块的开头(即在每个 # 注释字符之前),然后只需按下 tab 键或空格键插入空格。根据您在屏幕截图中的选择方式,您可以按左箭头键来达到我所描述的状态。还可以使用 editor.action.insertCursorAbove(默认绑定为<kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>up</kbd>)和相应的 editor.action.insertCursorBelow 键盘快捷命令 ID(用于 命令面板 中的 Add Cursor AboveAdd Cursor Below 命令),或者使用 alt+单击在特定位置插入/移除光标,或者使用 https://code.visualstudio.com/docs/editor/codebasics#_column-box-selection 中指定的各种其他控制选项。

英文:

Use multicursor editing and put the cursors at the start of the block that you currently have selected (I.e. before each of your # comment characters, and then just press tab or space to insert spacing). The way you have your selection set up in your screenshot, you can press the left arrow key to get to the state I was describing. See also the editor.action.insertCursorAbove (bound by default to <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>up</kbd>) and corresponding editor.action.insertCursorBelow keyboard shortcut command IDs (for the Add Cursor Above and Add Cursor Below commands in the command palette). Or use alt+click to insert/remove cursors at specific positions, or the various other controls specified in https://code.visualstudio.com/docs/editor/codebasics#_column-box-selection.

huangapple
  • 本文由 发表于 2023年6月9日 03:03:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76434964.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定