简体   繁体   English

TextMate切换注释宏已损坏

[英]TextMate toggle comment macro is broken

My laptop crashed and when it rebooted, "cmd /" (toggle comment) was broken. 我的笔记本电脑崩溃了,当它重新启动时,“cmd /”(切换注释)被打破了。 When I try to toggle comments on a line that only contains "foo", I get this output in my code instead of "# foo": 当我尝试在仅包含“foo”的行上切换注释时,我在代码而不是“#foo”中获得此输出:

/tmp/temp_textmate.2erfLj:68:in /bin/bash: -c: line 0: unexpected EOF while looking for matching '' /bin/bash: -c: line 1: syntax error: unexpected end of filemap' for " foo":String (NoMethodError) from /tmp/temp_textmate.2erfLj:48:in /bin/bash: -c: line 0: unexpected EOF while looking for matching '' /bin/bash: -c: line 2: syntax error: unexpected end of file' /tmp/temp_textmate.2erfLj:68:in / bin / bash:-c:第0行:在寻找匹配'' /bin/bash: -c: line 1: syntax error: unexpected end of filemap' for " foo":String (NoMethodError) from /tmp/temp_textmate.2erfLj:48:in /bin/bash: -c: line 0: unexpected EOF while looking for matching出现意外EOF '' /bin/bash: -c: line 1: syntax error: unexpected end of filemap' for " foo":String (NoMethodError) from /tmp/temp_textmate.2erfLj:48:in /bin/bash: -c: line 0: unexpected EOF while looking for matching ''/ bin / bash时'' /bin/bash: -c: line 1: syntax error: unexpected end of filemap' for " foo":String (NoMethodError) from /tmp/temp_textmate.2erfLj:48:in /bin/bash: -c: line 0: unexpected EOF while looking for matching :-c:第2行:语法错误:意外的文件结束'

This is driving me nuts 这让我疯了

Matt Hayes' answer pointed me to the trouble spot. Matt Hayes的回答指出了我的麻烦点。

Bundles -> Bundle Editor -> Edit Commands --> Source --> Comment Line / Selection Bundles - > Bundle Editor - > Edit Commands - > Source - > Comment Line / Selection

change line 139: 改变第139行:

- lines = text.to_a
+ lines = text.split(/$/).map(&:chomp)

#to_a is no longer a string method. #to_a不再是字符串方法。

http://ruby-doc.org/core-1.9.3/String.html http://ruby-doc.org/core-1.9.3/String.html

I ran into the same issue and figured out a workaround. 我遇到了同样的问题并找到了解决方法。 Reinstalling TextMate did not help in my case. 在我的情况下,重新安装TextMate没有帮助。

Bundles -> Bundle Editor -> Edit Commands --> Source --> Comment Line / Selection Bundles - > Bundle Editor - > Edit Commands - > Source - > Comment Line / Selection

At the top of the script you should see this: 在脚本的顶部,您应该看到:

#!/usr/bin/env ruby

I changed this to use another installation of Ruby. 我把它更改为使用另一个Ruby安装。 In my case I'm using RVM to manage different Ruby versions, so I have: 在我的情况下,我使用RVM来管理不同的Ruby版本,所以我有:

#!/Users/_username_/.rvm/rubies/ruby-1.8.7-p334/bin/ruby

So it seems something got screwed up with the default system Ruby. 所以似乎有些东西搞砸了默认的系统Ruby。

I had this same problem. 我有同样的问题。 Reinstalling TextMate seems to have solved the problem. 重新安装TextMate似乎已经解决了这个问题。

This problem appeared after migrating from one Mac to another. 从一台Mac迁移到另一台Mac后出现此问题。 I'm not sure if thats the cause though. 我不确定这是不是原因。 They where both MacBook Pro's running snow leopard. 它们都是MacBook Pro的雪豹。

If you're using ruby 2.0 or you recently upgraded to Mavericks (system ruby in Mavericks is now 2.0), edit abovementioned command and add "-Ku" to the first line, like so: #!/usr/bin/env ruby -Ku 如果您正在使用ruby 2.0或者您最近升级到Mavericks(Mavericks中的系统ruby现在是2.0),请编辑上述命令并在第一行添加“-Ku”,如下所示:#!/ usr / bin / env ruby​​ - 苦

Worked for me. 为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM