使用 textmate 打开文件夹后运行 compass watch 终端命令
我使用 textmate 进行网站开发,使用 compass 编译 css 样式表。现在,每次我用 textmate 打开文件夹时,我都必须另外运行 compass watch /path/to/folder
命令。我知道 textmate 非常强大,但不知道如何使其工作,因此 compass watch
命令会自动应用于您使用 textmate 打开的项目(我通常将项目文件夹拖动到停靠图标上)。这可能吗?
I use textmate for website development and compass to compile css stylesheets. Right now everytime I open up the folder with textmate I have to additionally run a compass watch /path/to/folder
command. I know textmate is pretty powerfull, but not sure how to make it work so the compass watch
command is automatically applied to projects you open with textmate (I usually drag the projectfolder on the dock-icon). Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然可以。您需要在 .bashrc 文件中创建一个小函数。
我基于为 SublimeText2 创建的别名来构建下面的函数,使其像“
mate dir/
”一样工作(我非常错过的一个功能):所以,你并不真的希望一个别名运行两个命令,因为别名是...特定命令的“别名”。然而,函数非常适合:
我选择了“matew” - 因为它就像 mate+watch,但您可以根据自己的记忆调用函数。 (例如
epicPwn()
等)因此,您的新函数将运行为:注意:请务必输入 TextMate 的正确路径。另外,如果您没有传递目录,显然compass watch 命令将会跟踪。同样,如果该目录没有指南针项目 ->
compass watch
将返回一个标准的“无项目”错误(但 TM 仍会打开 dir/)。例如:Sure thing. You will need to make a small function in your .bashrc file.
I based the function below off an alias I create for SublimeText2 to make it work like "
mate dir/
" (a feature I missed greatly):So, you don't really want an alias to run two commands, since an alias is...an "alias" for a specific command. However, a function is well suited:
I picked "matew" - cause it was like mate+watch, but you can call your function whatever you will remember. (e.g
epicPwn()
, etc) Thus, your new function is run as:Note: Just be sure to put the correct path to TextMate. Also, the
compass watch
command will fowl up if you aren't passing a directory, obviously. Similarly if the directory doesn't have a compass project ->compass watch
will spit back a standard "no project" error (but TM will still open the dir/). e.g.: