VS Code 粘贴时会修改文本的缩进

2017-11-20 11:20:06 +08:00
 allenlee7c9
今天用 Code 写 html 时发现有时候拷贝的文本是有缩进的,粘贴后却全部居左,得 Ctrl + z 才能恢复原有的缩进,不知道有没有人遇到过这种情况,该如何解决
11083 次点击
所在节点    全球工单系统
13 条回复
misaka19000
2017-11-20 11:21:26 +08:00
去掉 format-when-paste 选项就可以了
DOLLOR
2017-11-20 11:35:30 +08:00
应该是这个吧
"editor.autoIndent": false,
ie88
2017-11-20 12:00:24 +08:00
// Controls if the editor should automatically adjust the indentation when users type, paste or move lines. Indentation rules of the language must be available.
"editor.autoIndent": true,

true 改为 false
rocksolid
2017-11-20 12:02:17 +08:00
应该学学 sublime ctrl v 和 ctrl shift v 分开
DoraJDJ
2017-11-20 12:02:31 +08:00
我还想着要有这个功能呢,有时候要套用的代码复制粘贴过去还得人工调缩进真的是累死人...
whattheh3ll
2017-11-20 12:59:14 +08:00
原来是个 feature 而不是 bug.
Wicked
2017-11-20 15:59:50 +08:00
我比较烦的是它无视用户设定,自动把缩进改成空格,而我是用 tab 的
mxalbert1996
2017-11-20 17:51:30 +08:00
@Wicked
// 按 "Tab" 时插入空格。该设置在 `editor.detectIndentation` 启用时根据文件内容进行重写。
"editor.insertSpaces": true
你们用软件之前都不看设置的吗
Wicked
2017-11-20 21:12:44 +08:00
@mxalbert1996 最新版,设置了也不行…
janxin
2017-11-21 09:56:36 +08:00
@Wicked 已有的文件手动可以设置一下右下角的缩进选项试试
mxalbert1996
2017-11-21 14:20:32 +08:00
@Wicked 我这里最新版测试没有问题。
wclimb
2018-06-19 09:53:46 +08:00
最新版设置了也还是不行,很烦人
jearyvon
2019-09-05 14:23:29 +08:00
Editor: Format On Paste
把这个取消掉就好了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/407847

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX