有没有简单的方法可以切换“执行/结束”和“{}”在 Vim 中的 ruby 中?
有没有简单的方法可以在 Vim 中的 ruby 中切换“do/end”和“{}”?
(TextMate 使用 ^{
执行此操作。)
Is there any easy way to toggle "do/end" and "{}" in ruby in Vim?
(TextMate does this with ^{
.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须使用 searchpair() 或使用 % (只要安装了 matchit,并且处于开始/结束位置),然后标记两个位置,测试它是文本还是括号,最后更新两条线。
其中
lh#position#char_at_mark()
定义为 这里。PS:这绝对是一个 SO 问题,因为它结合了 ruby 上下文和高级 vim 脚本。
You'd have to either use searchpair(), or to play with % (as long as matchit is installed, and as you are on begin/end), then mark the two positions, test whether it's text or brackets, and finally update the two lines.
Where
lh#position#char_at_mark()
is defined here.PS: this is definitively a SO question as it combines ruby context, and advanced vim scripting.
查看这个新插件:https://github.com/jgdavey/vim-blockle。
30 个字符垫
Check out this new plugin: https://github.com/jgdavey/vim-blockle.
30 chars pad
有一个 splitjoin.vim 插件可以很好地完成此操作(用于拆分/连接的 gJ/gS 映射) 。
There is a splitjoin.vim plugin that does this nicely (gJ/gS mappings for splitting/joining).