【发布时间】:2009-07-11 23:23:29
【问题描述】:
我正在从网站 matplotlib 复制代码并粘贴到 Mac OS X 终端中的 Vim 编辑器中:
pylab_examples example code: ellipse_demo.py
虽然这在BBEdit 中运行良好:
`from pylab import figure, show, rand
from matplotlib.patches import Ellipse
NUM = 250
ells = [Ellipse(xy=rand(2)*10, width=rand(), height=rand(), angle=rand()*360)
for i in xrange(NUM)]
fig = figure()
ax = fig.add_subplot(111, aspect='equal')
for e in ells:
ax.add_artist(e)
e.set_clip_box(ax.bbox)
e.set_alpha(rand())
e.set_facecolor(rand(3))
ax.set_xlim(0, 10)
ax.set_ylim(0, 10)
show()
也就是说,所有代码都正确对齐。在 Vim 中是这样的:
from pylab import figure, show, rand
from matplotlib.patches import Ellipse
NUM = 250
ells = [Ellipse(xy=rand(2)*10, width=rand(), height=rand(), angle=rand()*360)
for i in xrange(NUM)]
fig = figure()
ax = fig.add_subplot(111, aspect='equal')
for e in ells:
ax.add_artist(e)
e.set_clip_box(ax.bbox)
e.set_alpha(rand())
e.set_facecolor(rand(3))
ax.set_xlim(0, 10)
ax.set_ylim(0, 10)
show()
如何解决这种烦人的情况?是否与 Mac 上不同的回车/换行约定有关?
【问题讨论】: