fisadev / vim-isort

Vim plugin to sort python imports using https://github.com/timothycrosley/isort
MIT License
219 stars 32 forks source link

The contents of `plugin/python_vimisort` is not a valid vimscript #27

Open char101 opened 5 years ago

char101 commented 5 years ago

I am using this plugin with vim package on Windows and got this error:

Error detected while processing vim\package\40-filetype_python\isort\plugin\python_vimisort.vim:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name '_vimisort' is not defined

Is that supposed to be a symlink or something? I think the right content of plugin\python_vimisort should be

runtime ftplugin\python_vimisort.vim
char101 commented 5 years ago

Also AFAIK pathogen adds the plugin path into &rtp so it should not have any problem with ftplugin.

humrochagf commented 2 years ago

Had the same issue on my vim setup when running on windows, and changed as pointed out to:

runtime ftplugin\python_vimisort.vim

And it worked.

On my Linux setup, I checked and it's is a symlink to the actual file. So I changed it to be a file with the command explained at the top and it also works :)

What happens is windows don't deal with symlinks the same way POSIX systems do, so by default git, when cloning repositories is that git on windows by default sets the config core.symlinks to false. So symlinks will be conned as plain textfiles.

You can have more info on that here: https://stackoverflow.com/questions/11662868/what-happens-when-i-clone-a-repository-with-symlinks-on-windows/11664406

As pointed at the link even setting symlinks to true you need to have administrator rights to be able to properly set up the policies, and you need to be cloning to a NTFS portion instead of a FAT one, so the approach suggested by @char101 is a great solution for the case to keep it multiplatform and with an easier setup.