vifm / neovim-vifm

A neovim plugin to use vifm like netrw and NERDTree.
Other
47 stars 1 forks source link

add file detect and syntax highlighting features #6

Closed coachshea closed 5 years ago

coachshea commented 6 years ago

As a neovim user, when I edit vifm files, such as $VIFMRC, I want to continue using neovim. Unfortunately, when I set up this vifm to do that, I lost my ftdetect and syntax highlighting. I have simply copied those files from the vifm/vifm.vim plugin into this plugin and it fixed the problem for me. I figured that others might benefit from this integration, so I decided to offer it as a pull-request.

This approach does have one drawback in that if future changes were made to the syntax file (ftdetect changes are unlikely), we would need to make sure that the two stayed synced, but I think that is much better than not having syntax highlighting at all. A more complex, but more easily maintainable solution, would be to combine the two plugins and move most of the logic to another folder and the plugin/vifm.vim file would simply contain the following:

if has('nvim')
  source myfolder/neovim.vim
else
  source myfolder/vim.vim
endif

Of course, I have no idea if this type of solution is desired, so I did not want do something that might be unwanted. If it was, it would be simple to do.

xaizek commented 6 years ago

What about installing both plugins, but disabling functionality of vifm.vim to avoid adding unused commands? It can be disabled by defining g:loaded_vifm to any value in vimrc:

let g:loaded_vifm = 'disable'

This should give you everything vifm.vim contains except for the plugin.

coachshea commented 6 years ago

Thank you for the quick response. That approach certainly works for me. I would suggest including something in the readme. Someone new to vifm who already uses neovim as their default editor (the number of people in this category will be increasing daily) might not find it intuitive that in order to edit vifm files with syntax highlighting they need to download a plugin meant for traditional vim and disable it. This would be true even if they didn't plan to use vifm as a netrw replacment. If a neovim user discovers vifm and uses it only from the command line, but wants to edit the vifmrc, they would still likely want syntax highlighting.

As an even simpler solution, is there any thought to including vifm ftdetect and syntax into the vim/nvim distributions themselves. They have so many now and the 'vifm' suffix wouldn't conflict with any. I wouldn't think it would be a problem.

Sorry for throwing so many ideas at you. I love vifm and, to me, vifm and vim/nvim integration is an amazing benefit to productivity. Anything that can help more people adopt it seamlessly is worth the effort.

Thank again for all your time.

-- John Shea

On Sun, Dec 31, 2017 at 10:35:47AM +0000, xaizek wrote:

What about installing both plugins, but disabling functionality of vifm.vim to avoid adding unused commands? It can be disabled by defining g:loaded_vifm to any value in vimrc:

let g:loaded_vifm = 'disable'

This should give you everything vifm.vim contains except for the plugin.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

xaizek commented 6 years ago

I would suggest including something in the readme.

That's probably worth doing, thanks.

As an even simpler solution, is there any thought to including vifm ftdetect and syntax into the vim/nvim distributions themselves.

Didn't think about that. It might be possible, but there is a disadvantage of possibly having mismatched versions of vifm and vim. At the moment vifm and the plugin is more likely to be synchronized, especially if instead of downloading the plugin separately, it's just included like this:

set runtimepath+=/usr/share/vifm/vim
rbong commented 5 years ago

This should be fixed by the merge with vifm.vim