-
-
Save mirek/7318623 to your computer and use it in GitHub Desktop.
nodejs textmate 2 run command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -wKU | |
require "#{ENV["TM_SUPPORT_PATH"]}/lib/escape" | |
require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/save_current_document" | |
require "#{ENV["TM_SUPPORT_PATH"]}/lib/tm/executor" | |
TextMate.save_if_untitled('cs') | |
TextMate::Executor.run(e_sh(ENV['TM_NODEJS'] || 'node'), ENV['TM_FILEPATH']) do |str, type| | |
if type == :err | |
if str =~ / | |
( ^ .* \b at \b .* \( ) | |
( ([^)]+) : (\d+) : (\d+) ) | |
( \) .* $ ) | |
/x | |
prefix, innards, file, line, col, suffix = $1, $2, $3, $4, $5, $6 | |
"<span class=\"err\">#{htmlize prefix}<a href=\"txmt://open?url=file://#{e_url file}&line=#{line}&column=#{col}\">#{htmlize innards}</a>#{htmlize suffix}</span><br>\n" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Name: Run nodejs
Scope Selector: source.js
Key Equivalent: CMD+R
Save: Modified Documents
Input: Document -> Format: Text
Output: Show in New Window -> Format: HTML