Cómo implementar el modo celular similar a MATLAB en Vim

En MATLAB, podemos escribir al editor la siguiente

%% -- a example cell --

plot(rand(3));

%% -- another cell
A=rand(2^10);
t=linspace(-pi,pi,2^10);
compass(fft(A*sin(t))

y podemos simplemente presionar Ctrl+Entra para ejecutar la celda en la que el puntero del mouse hace clic.

Ahora sé en Vim, puedo hacer

:'<,>'w !matlab para ejecutar un bloque de código seleccionado visualmente.

¿Pero cómo implemento el modo de celda similar a MATLAB en Vim / gVim?

Por ejemplo, un código de Python

import os
import subprocess
import random

## 1st cell
ps =["python", "-h"]
out = subprocess.Popen(ps).communicate()[0]
print out

## 2nd cell

# import random -sould not be needed if we concatenate the import section and the cell
print random.randint(1,100)

¿Alguien puede ofrecer algunas ideas?

Respuestas a la pregunta(2)

Su respuesta a la pregunta