Jer*_*oen 395 visual-studio-code
使用代码文件时,通常不需要更长的行来包装.但是,对于.md文件,这实际上非常有用.但是,我似乎无法找到启用自动换行的选项,因此将包裹更长的行.
要重现,请将VSCode的大小调整为足够小的窗口,然后在新文档中输入以下文本:
This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum.
A linebreak before this.
Run Code Online (Sandbox Code Playgroud)
效果是这样的:

我试图让水平滚动条远离,让窗户1的第1行环绕.
我已经做了一些事来回答我自己的问题:
也许这是不可能的,我需要提交功能请求?或者我错过了什么?
请注意,我希望能够快速打开和关闭它.其中一个,@ PanagiotisKanavos在评论中提到了这个解决方案来改变设置中的包装行为,但我正在寻找一个快速命令或菜单选项来做到这一点(很像Notepad ++和Sublime Text 2).
Ben*_*ero 653
从v1.0开始你可以切换自动换行:
editor.action.toggleWordWrap,或View菜单(查看>切换Word Wrap),或它也可以通过以下设置进行控制:
editor.wordWrapeditor.wordWrapColumneditor.wrappingIndent已知的问题:
Rad*_*tam 58
转到文件>首选项>用户设置.
它将自动打开默认设置settings.json.只需在settings.json文件中添加以下内容并保存即可.这将覆盖默认设置.
// Place your settings in this file to overwrite the default settings
{ "editor.wrappingColumn": 0 }
Run Code Online (Sandbox Code Playgroud)
Pix*_*omo 24
wrappingColumn已被弃用赞成wordWrap.
默认设置自动换行:
"editor.wordWrap": "on"
Run Code Online (Sandbox Code Playgroud)
要打开用户设置:
Mac:⌘+,
Windows:Ctrl+,
小智 20
使用命令面板适用于这个问题,也适用于许多类似的其他问题:
笔记:
截屏:
rob*_*uck 10
从1.9开始可以为自动换行设置(或任何设置)选择特定语言.您可以在命令面板中的以下位置找到:
首选项:配置语言特定设置...
对于您可能包含的所选语言,您将转到"settings.json":
"[markdown]": {
"editor.wordWrapColumn": 100,
"editor.wordWrap": "wordWrapColumn"
},
Run Code Online (Sandbox Code Playgroud)
此处解释了特定于语言的编辑器设置,但具体如下:
bounded您可能需要editor.wordWrapColumn根据屏幕尺寸调整值以换行。With bounded Lines 将会在视口和 editor.wordWrapColumn 的最小值换行例子:
"editor.wordWrapColumn": 200,
"[markdown]": {
"editor.wordWrap": "on",
},
"[plaintext]": {
"editor.wordWrap": "bounded",
},
"[typescript]": {
"editor.tabSize": 2,
"editor.wordWrap": "off",
},
Run Code Online (Sandbox Code Playgroud)
不确定它何时被添加,但我使用的是v0.10.8,而ALT + Z是用于打开和关闭自动换行的键盘快捷键.这满足了" 能够快速打开和关闭 "的要求.
关闭VS Code后,该设置不会保留.要坚持下去,你需要通过Radha使用该settings.json文件的答案来设置它...
// Place your settings in this file to overwrite the default settings
{ "editor.wrappingColumn": 0 }
Run Code Online (Sandbox Code Playgroud)
以下是新的自动换行选项:
editor.wordWrap: "off" - Lines will never wrap.
editor.wordWrap: "on" - Lines will wrap at viewport width.
editor.wordWrap: "wordWrapColumn" - Lines will wrap at the value of editor.wordWrapColumn.
editor.wordWrap: "bounded"
Run Code Online (Sandbox Code Playgroud)
线条将在视口宽度和 值的最小值处换行editor.wordWrapColumn。
这是来自截至 2020 年 5 月的 VS Code 文档:
以下是新的自动换行选项:
Run Code Online (Sandbox Code Playgroud)editor.wordWrap: "off" - Lines will never wrap. editor.wordWrap: "on" - Lines will wrap at viewport width. editor.wordWrap: "wordWrapColumn" - Lines will wrap at the value of editor.wordWrapColumn. editor.wordWrap: "bounded" - Lines will wrap at the minimum of viewport width and the value of editor.wordWrapColumn.
例如,如果您想让线条在窗口边界处换行,您应该:
打开settings.json(按 CTRL+SHIFT+P 并输入“settings.json”)
放入"editor.wordWrap": "bounded"json文件中,如下所示:
{
... ,
"editor.wordWrap": "bounded",
... ,
}
Run Code Online (Sandbox Code Playgroud)
然后它应该可以工作。
如果它在 Mac 中不起作用, 请确保告诉 VScode 您没有使用屏幕阅读器。
我打开了自动换行并重新启动了 VScode,它给了我一个通知窗口,提示我是否在屏幕阅读器中,是或否,并注意自动换行在屏幕阅读器中不起作用。
| 归档时间: |
|
| 查看次数: |
227130 次 |
| 最近记录: |