简体   繁体   English

如何使用命令提示符在Windows 7的Sublime中打开红宝石宝石?

[英]How do I open a ruby gem in Sublime on Windows 7 using command prompt?

I have added Sublime's directory to the system path, so when I enter " subl " in comman promot it opens the Sublime, that's fine. 我已经在系统路径中添加了Sublime的目录,所以当我在subl中输入“ subl ”时,它会打开Sublime,这很好。 But, 但,

When I tried to open a ruby gem, I remembered the command used in Linux etc which is " bundle open xyz ", I entered this command to Windows 7's command prompt it gave me an error as " To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR ". 当我尝试打开一个红宝石宝石时,我记得在Linux等中使用的命令是“ bundle open xyz ”,我在Windows 7的命令提示符下输入了此命令,它给了我一个错误:“ 要打开捆绑的宝石,请设置$ EDITOR或$ BUNDLER_EDITOR ”。

I assumed that I must mention that i wanna open it through sublime, so I edited the command as " subl bundle open sass ", but it opened a new file named ''bundle open sass'' in sublime (not the sass gem). 我以为我必须提到我想通过sublime打开它,所以我将命令编辑为“ subl bundle open sass ”,但它在sublime中打开了一个名为“ bundle open sass”的新文件 (不是sass gem)。 Does anyone know how to open a ruby gem in sublime or whatever editor from command prompt in Windows? 有谁知道如何在Windows中从命令提示符中打开Sublime中的ruby gem? Thank You! 谢谢!

Edit: After pdobb 's answer I created a variable named EDITOR in my environment variables, and set its value to subl (I assumed that the path is not needed along the "subl" because its path is already set in the path variable), but now its showing the error as "Could not locate gemfile", but when I list my gems its there. 编辑:pdobb回答之后,我在我的环境变量中创建了一个名为EDITOR的变量,并将其值设置为subl(我假设沿着“ subl”不需要该路径,因为它的路径已经在path变量中设置了),但是现在它显示错误为“无法找到gemfile”,但是当我在其中列出我的gem时。

Here is the snapshot of how I set the EDITOR variable. 这是我如何设置EDITOR变量的快照。 系统环境变量中的EDITOR变量。

The command is bundle open xyz , as you've said. 如您所说,该命令是bundle open xyz The editor you want to use is set in the $EDITOR or $BUNDLER_EDITOR environment variable. 您要使用的编辑器在$EDITOR$BUNDLER_EDITOR环境变量中设置。 In effect, bundler checks this environment variable for what editor to open the gem in. So, you just need to set the environment variable $EDITOR to subl . 实际上,捆绑程序会在此环境变量中检查打开gem的编辑器。因此,您只需要将环境变量$EDITORsubl This is done in the same place as where you set your $PATH environment variable. 这与设置$PATH环境变量的位置相同。 See here for a guide. 请参阅此处以获取指南。

you can go to the directory where the gem is installed and open the directory with your editor. 您可以转到安装gem的目录,然后使用编辑器打开目录。

For example, 例如,

If the ruby gems are installed on .rvm/ruby-2.1.0/gems/. 如果将宝石红宝石安装在.rvm / ruby​​-2.1.0 / gems /上。 Let's say, you want to open 'capybara' gem. 假设您要打开“水豚”宝石。 then open the .rvm/ruby-2.1.0/gems/capybara in your editor 然后在编辑器中打开.rvm / ruby​​-2.1.0 / gems / capybara

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

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