vim-isort
vim-isort copied to clipboard
vim-isort not working with anaconda isort
FIrst of all, very cool plugin, thank you for making this.
I followed the instructions and when I hit pip install isort
, I was happy to see this response from my terminal
Requirement already satisfied: isort in /anaconda/lib/python2.7/site-packages
I selected the lines I wanted to sort, hit Ctrl-i
and got this in response
No isort python module detected, you should install it. More info at https://github.com/fisadev/vim-isort
Confused, I tried setting my python version with this in my vimrc
file
let g:vim_isort_python_version = 'anaconda/lib/python2.7/site-packages'
But got this as a response
Error detected while processing /Users/brian/.vim/plugin/python_vimisort.vim:
line 28:
E121: Undefined variable: s:available_short_python
E15: Invalid expression: s:available_short_python "isort_visual()<CR>"
line 31:
E492: Not an editor command: AvailablePython <<EOF
line 32:
E492: Not an editor command: from __future__ import print_function
line 33:
E492: Not an editor command: import vim
line 34:
E492: Not an editor command: from sys import version_info
line 36:
E488: Trailing characters: try:
line 37:
E492: Not an editor command: from isort import SortImports
line 38:
E492: Not an editor command: isort_imported = True
line 39:
E492: Not an editor command: except ImportError:
line 40:
E492: Not an editor command: isort_imported = False
line 43:
E488: Trailing characters: # in python2, the vim module uses utf-8 encoded strings
line 44:
E488: Trailing characters: # in python3, it uses unicodes
line 45:
E488: Trailing characters: # so we have to do different things in each case
line 46:
E492: Not an editor command: using_bytes = version_info[0] == 2
line 49:
E492: Not an editor command: def count_blank_lines_at_end(lines):
line 50:
E492: Not an editor command: blank_lines = 0
line 51:
E121: Undefined variable: lines
E116: Invalid arguments for function reversed(lines):
E15: Invalid expression: reversed(lines):
line 56:
E133: :return not inside a function
line 62:
E133: :return not inside a function
line 90:
E170: Missing :endwhile
Trying this let g:vim_isort_python_version = 'anaconda/lib/python2.7'
returned the same result as above
Help please? Thanks for the awesome plugin!
I also hit
:py import isort
and got this in response
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/anaconda/lib/python2.7/site-packages/isort/__init__.py", line 25, in <module>
from . import settings
ImportError: cannot import name settings
When opening up python via terminal, the command import isort
works
Thanks again!
I find the g:vim_isort_python_version
option confusing. It looks like you might be able to specify a path to a python interpreter, but in reality it is only looking for a match on the string python3
or python2
. Providing anything but those two strings results in the confusing error mentioned above:
Error detected while processing /Users/brian/.vim/plugin/python_vimisort.vim:
line 28:
E121: Undefined variable: s:available_short_python
... + 50 lines or so ...