Iām trying to replicate TextMates ctrl+shift+v Validate Syntax, specifically for PHP. Itās handy to quickly check if there are any errors before saving a remotely-edited file, instead of finding the error in the web browser.
This is the command used in TM:
#!/usr/bin/env ruby
require ENV'TM_SUPPORT_PATH'] + '/lib/textmate'
version = %x{#{ENV'TM_PHP'] || 'php'} -v}.split[0..2].join(' ')
puts "Running syntax check with " + version + "ā¦"
result = `#{ENV'TM_PHP'] || 'php'} -d display_errors=on -l`
puts result.gsub('in -', '')
TextMate.go_to :line => $1 if result =~ /line (\d+)/
Any suggestions as to the best way to reproduce this in ST2? My first attempt was along the lines of:
{ "keys": "ctrl+shift+v"], "command": "exec", "args": { "cmd": "php -d display_errors=on -l $TM_FILENAME"]} }
ā¦ but that obviously didnāt work. Sorry for the dumb question, I know it should be dead easy, but Iām new to learning ST2 and any help is appreciated.