1

我想更改 textmate 包“Create Partial From Selection”,它依赖于一个名为“create_partial_from_selection.rb”的文件。

我已经更改了上面的文件,所以它输出双引号,而不是单引号。问题是我不知道把这个编辑过的文件放在哪里。我尝试将我编辑的文件放在 ~/Library/Application Support/TextMate/Bundles 中,但是这个文件有依赖项,而这些依赖项又具有更多的依赖项,所以这并没有真正起作用。

请问有什么指点吗?

4

1 回答 1

1

Disclaimer: I have never actually done anything regarding bundle creation/editing for textmate. These are just suggestions based on what I was able to glean looking through them.

The directory (for my bundle) that the source code is in is here:

~/Library/Application Support/TextMate/Bundles/Ruby On Rails.tmbundle/Support/bin

If you open textmate, then click "Bundles" in the menu bar, then "Bundle Editor", then "Show Bundle Editor", you'll see a list of all your bundles and can get to all the actions within them. Under "Create Partial from Selection", I have the following:

RUBYLIB="$TM_BUNDLE_SUPPORT/lib:$RUBYLIB"
"${TM_RUBY:=ruby}" -- "${TM_BUNDLE_SUPPORT}/bin/create_partial_from_selection.rb"

I have no idea what best practice dictates for this, but it seems like you have two options:

  1. Change the path in Bundle editor from "${TM_BUNDLE_SUPPORT}/bin/create_partial_from_selection.rb" to something else (perhaps "${TM_BUNDLE_SUPPORT}/bin/create_partial_from_selection_double_quotes.rb" ?). Then drop your new file in the same directory alongside the original. I suppose you could also make your own action in bundle editor with all the same settings for a completely separate command. With this option you'll keep the original source code (good in case you accidentally introduced a hard to track down bug).

  2. Overwrite create_partial_from_selection.rb in the bundle directory with your new file. Probably faster, but you lose the original command in bundle editor. I probably would suggest making a backup of the original, but you could also find it online or re-download the bundle pretty easily, so maybe not as big a deal to you if you always have internet access.

Good luck!

于 2011-06-13T21:40:29.800 回答