sillybun / vim-repl

Best REPL environment for Vim
GNU General Public License v2.0
446 stars 39 forks source link

Ipython magic function support. #60

Open roachsinai opened 4 years ago

roachsinai commented 4 years ago

Describe the bug

When using %%timeit to get exec time of a code block, like below:

%%timeit
mean, var = 0., 0.
for i in range(1000000):
    x = np.random.randn()
    a = np.random.randn()
    z = np.random.randn()
    m = np.random.randn()
    y = x * a * z * m
    mean += y
    var += y**2
mean / 1000000, math.sqrt(var / 1000000)

Get indent error when using SendLineToREPL(post below).

Screenshots

image

Additional context

From the Traceback like below, can find no spaces(indent) following each \n.

get_ipython().run_cell_magic('timeit', '', 'mean, var = 0., 0.\nfor i in range(1000000):\nx = np.random.randn()\na = np.random.randn()\nz =

sillybun commented 4 years ago

Good idea. I will fix it in a few days.