hanschen / vim-ipython-cell

Seamlessly run Python code in IPython from Vim
GNU General Public License v3.0
335 stars 18 forks source link

Using "##" string within your code. #44

Closed uygarkurt closed 1 year ago

uygarkurt commented 1 year ago

Hi, amazing app. Very very useful. Thank you.

I encountered an edge case.

I want to find the string "##" inside my code. However since it's a cell seperator I can't. How to deal with it? such as: if s.index("##"):

One more question. Can I make vim to save the file when I run a cell?

hanschen commented 1 year ago

Hi, thanks for your nice comment.

Try this (I haven't tried it myself yet):

let g:ipython_cell_regex = 1
let g:ipython_cell_tag = '^\s*##'

One more question. Can I make vim to save the file when I run a cell?

Sure, just make your mapping save the file first. There's an example in the README: https://github.com/hanschen/vim-ipython-cell#matlab-like-key-bindings

hanschen commented 1 year ago

Closing this as solved, you can reopen if the solution above doesn't work.