diff --git a/Commands/New Function =>.tmCommand b/Commands/New Function =>.tmCommand new file mode 100644 index 0000000..5bc2660 --- /dev/null +++ b/Commands/New Function =>.tmCommand @@ -0,0 +1,35 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +token = "=>" +line = ENV['TM_CURRENT_LINE'] + +if line[-1..-1] == " " + print "(${1:args}) #{token}\n $0" +else + print "${TM_SELECTED_TEXT:-$TM_CURRENT_WORD} = (${1:args}) #{token}\n $0" +end + + + fallbackInput + word + input + selection + keyEquivalent + ~$ + name + New Function => + output + insertAsSnippet + scope + source.coffee + uuid + D94D14A8-7A96-41EC-BF67-03636A76C025 + + diff --git a/Commands/New Function.tmCommand b/Commands/New Function.tmCommand index 3833b47..62d27e0 100644 --- a/Commands/New Function.tmCommand +++ b/Commands/New Function.tmCommand @@ -5,10 +5,18 @@ beforeRunningCommand nop command - cat <<SNIPPET -${TM_SELECTED_TEXT:-$TM_CURRENT_WORD} = (\${1:args}) -> - \$0 -SNIPPET + #!/usr/bin/env ruby + +token = "->" +line = ENV['TM_CURRENT_LINE'] + +if line[-1..-1] == " " + print "(${1:args}) #{token}\n $0" +else + print "${TM_SELECTED_TEXT:-$TM_CURRENT_WORD} = (${1:args}) #{token}\n $0" +end + + fallbackInput word input diff --git a/info.plist b/info.plist index a2c5eef..58ae270 100644 --- a/info.plist +++ b/info.plist @@ -13,6 +13,7 @@ C5D6C716-12FE-4CE8-A916-6CABEDE8AFE7 EE3293A5-3761-40BD-9CA8-DAAA176AA19E 192428A1-8684-4172-8728-225B4C9E532F + D94D14A8-7A96-41EC-BF67-03636A76C025 30395DAB-44A6-44F7-99E1-02D64621303A D749F761-1740-4918-9490-90DF376BA72E 90424631-D00B-448C-B157-DAC92DFB2858 @@ -36,6 +37,7 @@ 8A65E175-18F2-428F-A695-73E01139E41A C04ED189-6ACB-44E6-AD5B-911B760AD1CC FBC44B18-323A-4C00-A35B-15E41830C5AD + D7ADBF4B-B25B-4CF6-8FC0-C4FB0C3DBE64 uuid A46E4382-F1AC-405B-8F22-65FF470F34D7