Open laszloszurok opened 3 years ago
If you are still using vifm, maybe you would like to implement this and send a PR. I would fix this but I don't use the file manager extensions so it will take longer for me to test it. It looks like this will need to be fixed for all of the file manager wrappers, right?
floaterm health check
My Configurations related to vim-floaterm
Description of the bug:
File browsers like vifm, nnn, lf, etc. won't open in floaterm if the file in the currently focused buffer is owned by root. If I run FloatermNew vifm, i get the following error messages:
Error detected while processing function floaterm#run[7]..floaterm#new[19]..floaterm#wrapper#vifm#: line 3: E472: Command failed Error detected while processing function floaterm#run: line 7: E171: Missing :endif
Steps to reproduce
A solution
I skimmed through the code and found the line which causes the problem. In the autoload/floaterm/wrapper/vifm.vim file this line
fails if the owner is root. This is the case with the other file manager wrappers as well.
Fortunately I also found a solution. Instead of lcd %:p:h we can use this:
The functionality is the same, but now file managers will correctly work with any file.
I use a plugin called suda.vim which makes it easier to edit files owned by root. This plugin renames readonly buffers if let g:suda_smart_edit = 1 is set and this will make my solution above not to work. To provide compatibility with the suda plugin I extended my solution above like this:
Just thought I leave this here if anyone else uses suda.vim