TextMate toggle comment macro is broken

杀马特。学长 韩版系。学妹 提交于 2019-11-30 13:44:25

I had this same problem. Reinstalling TextMate seems to have solved the problem.

This problem appeared after migrating from one Mac to another. I'm not sure if thats the cause though. They where both MacBook Pro's running snow leopard.

Matt Hayes' answer pointed me to the trouble spot.

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

change line 139:

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

#to_a is no longer a string method.

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

Matt Hayes

I ran into the same issue and figured out a workaround. Reinstalling TextMate did not help in my case.

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. In my case I'm using RVM to manage different Ruby versions, so I have:

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

So it seems something got screwed up with the default system Ruby.

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

Worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!