Vim 中的 Ruby 代码自动缩进
我已将 Ruby 示例复制到 Vim 中,但事实证明这弄乱了缩进。 我尝试让 Vim 应用 Ruby 特定的缩进。为此,我取消了全局 vimrc 文件中以下行的注释:
if has ("autocmd")
filetype plugin indent on
endif
并在 Vim 中按下了 gg=G
。现在它更改了一些缩进,但仍然存在一些错误:
- 类定义没有缩进。
- 注释不会缩进并保留在行首。
I have copied a Ruby example into Vim, but it turns out that this messed up the indentation.
I tried to make Vim apply the Ruby specific indentation. To do that I uncommented the following lines in the global vimrc file:
if has ("autocmd")
filetype plugin indent on
endif
And pressed gg=G
in Vim. Now it changes some of the indentation, but it still has some errors:
- Class definitions don't get indented.
- Comments don't get indented and remain at the start of the lines.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在从外部源粘贴之前,使用此命令
:set Paste
然后进入插入模式并粘贴。
Before paste from outer source, use this command
:set paste
then enter to insert mode and paste.