-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IPyRunCell
function to execute a cell.
#30
base: master
Are you sure you want to change the base?
Conversation
min_indent = indent | ||
|
||
# Perform dedent | ||
if min_indent > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary, IPython kernel will strip off largest common indent of a cell automatically.
|
||
# Execute cell | ||
lines = "\n".join(cur_buf[upper_bound:lower_bound+1]) | ||
reply = self.waitfor(self.kc.execute(lines, silent=silent)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here instead just call self.ipy_run
cur_buf = self.vim.current.buffer | ||
(cur_line, cur_col) = self.vim.current.window.cursor | ||
cur_line -= 1 | ||
def is_cell_separator(line): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be implemented much simpler vimL-side, where we can use ordinary regex search()
. Instead we should probably have a Python function IPyRunLines which takes a line range.
I implemented cells vimscript side on master. See the "Cells" section in readme. |
I added wmvanvliet's
wmvanvliet's run_cell
function, to emulate a cell mode.The collection of lines is implemented in python which should be faster. Please check if I adjusted the code the right way, as I only tried to emulate your
ipy_run
function with his code and I actually don't know how neovim plug-ins work.The cell separators should probably be refactored into a vimscript variable, to be configurable.