From 905a22f032d5961fc95af8f90bf70c423602c6fc Mon Sep 17 00:00:00 2001 From: Doug Beney Date: Fri, 12 Jan 2018 17:08:24 -0500 Subject: [PATCH] Python3 support --- plugin/image.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/image.vim b/plugin/image.vim index 16fb80d..7298f15 100644 --- a/plugin/image.vim +++ b/plugin/image.vim @@ -1,7 +1,7 @@ command! -nargs=0 Image call DisplayImage() -if !has("python") - echo "image.vim requires python support" +if !has("python3") + echo "image.vim requires python3 support" finish endif @@ -9,7 +9,7 @@ au BufRead *.png,*.jpg,*.jpeg :call DisplayImage() function! DisplayImage() set nowrap -python << EOF +python3 << EOF from __future__ import division import vim from PIL import Image @@ -53,9 +53,9 @@ def getAsciiImage(imageFile, maxWidth, maxHeight): # clear the buffer vim.current.buffer[:] = None - for y in xrange(scaledHeight): + for y in range(scaledHeight): asciiImage = "" - for x in xrange(scaledWidth): + for x in range(scaledWidth): rgb = pixels[x, y] if not isinstance(rgb, tuple): rgb = (rgb,)