summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Melnikow <paul.melnikow@bodylabs.com>2014-12-29 14:48:24 -0500
committerncanceill <nicolas.canceill@ens-cachan.org>2015-06-11 21:10:34 +0200
commit4c409b0de918e62f9354cbc604c6ae65da611caf (patch)
tree06002f1e4284968e1d9d38c38e6a2a889421d4de
parente8ac8b9b5f82369635d719408f8b4adc5d97bcf9 (diff)
downloadzsh-4c409b0de918e62f9354cbc604c6ae65da611caf.tar.gz
zsh-4c409b0de918e62f9354cbc604c6ae65da611caf.tar.bz2
zsh-4c409b0de918e62f9354cbc604c6ae65da611caf.zip
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.
-rw-r--r--plugins/sublime/sublime.plugin.zsh2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index 4d9979960..3e338e4d3 100644
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/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