Vimjas / vim-python-pep8-indent

A nicer Python indentation style for vim.
Creative Commons Zero v1.0 Universal
789 stars 69 forks source link

vim8 +packages compatibility #67

Closed lgalke closed 7 years ago

lgalke commented 7 years ago

Hello @hynek, Unfortunately, your plugin does not work in my recent vim8 setup anymore. Here is a minimal example:

def f(x,                                                                                                                  
           y):                                                                                                               
    """ scriptnames:                                                                                                      
    [...]                                                                                                                 
    114: /usr/share/vim/vim80/indent/python.vim                                                                           
    115: ~/git/veight/vim/pack/extra/start/vim-python-pep8-indent/indent/python.vim                                                [...]                                                                                                                 
    >>> set smartindent?
    nosmartindent                                                                                                         
    """                                                                                                                   
    d = {"k1": 1,                                                                                                         
                 "k2": 2                                                                                                       
            }                                                                                                             
    return d                                                                                                              

# vim: set ts=8 sts sw=4 sts:

It is installed with vim's native packaging system, located in ~/.vim/pack/*/start

After some investigation, I found out that vims native indent/python.vim gets sourced before the indent file of this plugin (because of vim8s +packages) and sets b:did_indent. I fixed it by changing the guard to b:did_pep8_indent. I know that this fix is somewhat violating vim conventions but for now, it works for me. Could you think of a cleaner solution to integrate in vim8 packages system?

Best Regards, lgalke

hynek commented 7 years ago

Sadly I can’t since I’m on Spacemacs now for a while and @blueyed is doing all the work. 🤷‍♂️ Which reminds me that I should probably transfer the repo to him…

hynek commented 7 years ago

(Daniel please remove your fork of the repo so I can transfer it to you; there’s no reason for me taking any credit for the work you do.)

lgalke commented 7 years ago

So I found the reason here vimtex#645. When your .vim is a symlink, it's content (especially pack/) does get loaded after internal filetype, indent, etc scripts. Solution: Clone your vim directory directly into ~/.vim..

blueyed commented 7 years ago

@hynek I've deleted my fork now, so you can transfer the ownership.

hynek commented 7 years ago

Transfer initiated. Thanks and good luck! :)

blueyed commented 7 years ago

Thanks! :)

hynek commented 7 years ago

(maybe you should rewrite License and Authorship though, it reads really weird now :))

boertel commented 7 years ago

To complete @lgalke answer, another solution is to add this to your .vimrc:

set runtimepath=$HOME/repos/dotfiles/vim,$VIMRUNTIME

In this case, .vim can stay a symlink.

Link: https://github.com/lervag/vimtex/issues/586