michaelb/sniprun

[question] can it run a whole file in addition of a snippet/selection?

azinsharaf opened this issue · 5 comments

[question] can it run a whole file in addition of a snippet/selection?

Well yes, with something along the lines of :%SnipRun

Though, if you have a multi-files project and do thing like relative path imports those won't play well with sniprun

I just need to run the current buffer (file)

Regarding the multiple files can it run classes or utils file if they are beside the main.py?

closing this because unfortunately it is not supported on windows. I have to use both linux and win since i code on both.

Classes or utils in other files are not supported.

Though, if we're talking about python, there is a feature called REPL-like behavior that makes sniprun behaves, well, like a REPL.

So, as long as you run through sniprun the classes / utils once, they'll be available in every future snippet. See the doc for setup/usage: https://michaelb.github.io/sniprun/sources/README.html#repl-like-behavior

It's not as convenient as 'automagically fetching' the necessary code from any file in the project, but if you're staying in the editor for a somewhat long/continuous time, it might be good enough.