cocopon / vaffle.vim

:file_folder: Lightweight, window-based file manager for Vim
MIT License
284 stars 20 forks source link

Vaffle and projectionist interfere with one another #56

Open WhoIsSethDaniel opened 4 years ago

WhoIsSethDaniel commented 4 years ago
WhoIsSethDaniel commented 4 years ago

I use the projectionist vim plugin (https://github.com/tpope/vim-projectionist). When I attempt to use :Vaffle an exception occurs:

Error detected while processing function vaffle#init[45]..function vaffle#init[39]..vaffle#buffer#init[3]..BufFilePost Autocommands for "*"..function ProjectionistDetect[14]..<SNR>50_load[2]..script /home/seth/.vim/pack/git-plugins
/opt/vaffle.vim/autoload/vaffle.vim:
line  123:
E127: Cannot redefine function vaffle#init: It is in use

When in autoload/vaffle/buffer.vim the 'file' command is used to rename the buffer this triggers an autocommand in projectionist that attempts to detect the type of the buffer. Beyond that I'm unclear on exactly what is happening. I will continue to look at it but I don't know that I'll resolve this issue on my own.

To replicate simply install projectionist and attempt to run Vaffle.

WhoIsSethDaniel commented 4 years ago

The most radical change that will work is to use 'noautocmd' for the line that runs 'file'. This seems like using a nuclear bomb to kill a fly.

autoload/vaffle/buffer.vim:

 execute printf('silent noautocmd keepalt file %s',
        \ s:generate_unique_bufname(a:filer.dir))
WhoIsSethDaniel commented 4 years ago

I can

let g:projectionist_ignore_vaffle = 1

in my config and this will ignore anything with the namespace 'vaffle'. This appears to be undocumented but is in the projectionist code. It also keeps projectionist and vaffle from interfering with one another.

WhoIsSethDaniel commented 4 years ago

The actual cause of the problem appears to be projectionist attempting to execute "runtime! autoload/vaffle.vim" from within s:load() in the plugin/projectionist.vim code. I haven't wrapped my head around all that projectionist is doing. For now I think I'm going to just do the thing I mention in the above comment.

ajitid commented 3 years ago

@WhoIsSethDaniel does using let g:projectionist_ignore_vaffle = 1 causes any issue or disables any feature? I too am facing the same issue and applied the fix you suggested.

WhoIsSethDaniel commented 3 years ago

@WhoIsSethDaniel does using let g:projectionist_ignore_vaffle = 1 causes any issue or disables any feature? I too am facing the same issue and applied the fix you suggested.

I've been using it without issue for months. Doesn't remove any features as far as I can tell.