Run python in scratch buffer. #435
linusboehm
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I really like the option to run lua in a scratch buffer (default keyboard shortcut is:
<leader>.
to open the scratch buffer and then<cr>
to execute the lua snippet.I wanted a similar behavior for python and added the following to my config. It executes the python snipped and shows the result in a scratch buffer at the bottom. Thought it might be helpful for others:
and then in the
opts
for thesnacks
lazyvim config:This works for the entire buffer and the current visual selection and shows tracebacks in case of an error in the python script. Most of the runPython function is based on the function that is used to execute lua snippets.
Beta Was this translation helpful? Give feedback.
All reactions