Guest User

Untitled

a guest
Jun 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. ruby << ENDRUBY
  2.  
  3. require 'rubygems'
  4. require 'appscript'
  5. include Appscript
  6.  
  7. class ITerm
  8. class << self
  9. def activate;
  10. @iterm ||= app('iTerm')
  11. end
  12.  
  13. def write(cmd)
  14. @iterm.current_terminal.sessions.write(:text => cmd)
  15. end
  16. end
  17. end
  18.  
  19. class MacVim
  20. class << self
  21. def activate
  22. @app ||= app('MacVim')
  23. @app.windows.first.activate
  24. end
  25. end
  26. end
  27. ENDRUBY
  28.  
  29. fun! ITermWrite(cmd)
  30. ruby << ENDRUBY
  31. cmd = VIM::evaluate('a:cmd')
  32. ITerm.activate
  33. ITerm.write(cmd)
  34. MacVim.activate
  35. ENDRUBY
  36. endfun
Add Comment
Please, Sign In to add comment