Posted By

manatlan on 10/01/09


Tagged

lua scite


Versions (?)

Scite : insert command output in the editor


 / Published in: Textpattern
 

  1. ###########################################################
  2. ## DECLARATIONS IN SCITE PROPERTIES
  3. ###########################################################
  4. # define lua scripts
  5. ext.lua.startup.script=$(SciteUserHome)/.SciTEUser.lua
  6.  
  7. # define entry in context menu
  8. user.context.menu=||Insert Snippet|1121|\
  9.  
  10. # define the command '21'
  11. command.name.21.*=Insert Snippet
  12. command.21.*=InsertSnip
  13. command.save.before.21.*=2
  14. command.subsystem.21.*=3
  15. command.replace.selection.21.*=0
  16.  
  17. ###########################################################
  18. ## DECLARATIONS IN $(SciteUserHome)/.SciTEUser.lua
  19. ###########################################################
  20. function capture(cmd)
  21. local f = assert(io.popen(cmd, 'r'))
  22. local s = assert(f:read('*a'))
  23. f:close()
  24. return s
  25. end
  26.  
  27. function InsertSnip()
  28. editor:AddText(capture('gsnip'))
  29. end

Report this snippet  

You need to login to post a comment.