Hi,
I am using Execute-selection-in-Python-and-append-master plugin in order to test python code directly through vim. Now the python code is working and return me a list that contains strings typed like "file linenumber linecontent".
I would like not to replace buffer content by result of python code but affect cexpr to the list content in order to navigate through results with quickfix list.
Can you help me to build that cexpr list ?
By advance Thank you
Here it is the code of PyExecReplace that replace content of my buffer (python code) by result of execution code.
python << EOL
import vim, StringIO,sys
def PyExecReplace(line1,line2):
r = vim.current.buffer.range(int(line1),int(line2))
redirected = StringIO.StringIO()
sys.stdout = redirected
exec('\n'.join(r[:]) + '\n')
sys.stdout = sys.__stdout__
output = redirected.getvalue().split('\n')
r[:] = output[:-1] # the -1 is to remove the final blank line
# vim.command("echo "+"-".join(("a", "b", "c")))
redirected.close()
EOL
command! -range Pyer python PyExecReplace(<f-line1>,<f-line2>)
command! -range Pyea python PyExecAppend(<f-line1>,<f-line2>)
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment