浏览代码

sublime: Make subl a function so it can be called from functions in other modules

Without this change, whether a function can invoke 'subl' depends on the order in which modules are loaded. With this change, the order doesn't matter.

zsh resolves aliases at parse time not run time, which means if you invoke an alias from a function, the alias must be defined before the function.

See http://stackoverflow.com/a/25532276/893113 which refers to an explanation of this limitation.

For code which may be used non-interactively, the recommend workaround is to use functions instead of aliases.
Paul Melnikow 10 年之前
父节点
当前提交
4c409b0de9
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      plugins/sublime/sublime.plugin.zsh

+ 1 - 1
plugins/sublime/sublime.plugin.zsh

@@ -34,7 +34,7 @@ elif  [[ "$OSTYPE" = darwin* ]]; then
 
     for _sublime_path in $_sublime_darwin_paths; do
         if [[ -a $_sublime_path ]]; then
-            alias subl="'$_sublime_path'"
+            subl () { "$_sublime_path" $* }
             alias st=subl
             break
         fi