NTBBloodbath / cheovim

Neovim configuration switcher written in Lua. Inspired by chemacs.
GNU General Public License v2.0
332 stars 13 forks source link

file in after/ftplugin.vim of config folder doesn't source settings #2

Open rafamadriz opened 3 years ago

rafamadriz commented 3 years ago

Hey, thanks for the awesome, plugin.

I noticed that file in after/ftplugin.vim of my nvim config folder wasn't being loaded. All the files under after/ftplugin/** did get source without issues. But that one didn't. I know that the README says that you don't support init.vim but it's not clear to me if that means every single vim file, or just the main one at the top of your config folder (meaning init.lua or init.vim).

If we get enough requests we will implement init.vim support too, but for now keep up with the times!

If this means every single vim file, that explains why after/ftplugin.vim wasn't being loaded.

vhyrro commented 3 years ago

By .vim we just meant init.vim, everything else should get loaded. I just tried creating an after/ftplugin.vim and just placed an echom "Test" call inside and everything works fine, both when loading the config and when switching it. I'm unsure whether this is some sort of timing issue, or whether maybe you messed something up on your end? I'd double check the directory structure to make sure everything works, you can also post the dir structure here so we can check it out and potentially debug it :)

rafamadriz commented 3 years ago

Here's my folder structure:

├── after
│   ├── ftplugin
│   │   ├── gitcommit.lua
│   │   ├── html.lua
│   │   ├── javascript.lua
│   │   ├── javascriptreact.lua
│   │   ├── lua.lua
│   │   ├── markdown.lua
│   │   ├── qf.vim
│   │   ├── sh.lua
│   │   └── typescript.lua
│   └── ftplugin.vim
├── init.lua
├── lua
│   ├── config.lua
│   ├── lsp
│   │   ├── init.lua
│   │   └── servers.lua
│   ├── mappings.lua
│   ├── options.lua
│   ├── pack.lua
│   ├── plugins
│   │   ├── completion.lua
│   │   ├── indent-guides.lua
│   │   ├── startify.lua
│   │   ├── statusline.lua
│   │   ├── telescope.lua
│   │   ├── tree.lua
│   │   ├── treesitter.lua
│   │   └── which-key.lua
│   └── utils
│       ├── debug.lua
│       ├── extra.lua
│       ├── init.lua
│       └── install.sh

Here's what I have on my after/ftplugin.vim. The first thing I noticed wasn't working was the highlight on yank function. You can see that the last commit on the file is moving the highlight on yank thing to another place, but at that point I didn't know why suddenly it stopped working. I realized that none of the things I had in there were working actually. After some time debugging (I even downgraded my neovim version thinking the last update broke something),I removed cheovim and it all worked again.

Also worth saying that I followed all instructions when installing.

  1. Removed everything under ~/.local/share/nvim/site/pack/**
  2. Removed plugin/packer_compile.vim of my config folder.
vhyrro commented 3 years ago

Huh, what a weird bug. I ran your configuration through cheovim and would you know it, everything worked just fine. The ftplugin stuff worked exactly as I'd expect. This leads me to believe that maybe it's a timing issue? I have fairly fast hardware, and so maybe my buffer loads fast enough that the ftplugin has time to trigger? Although I don't know what specs you're running so that's a total shot in the dark. I'll try doing a bit more research, however I don't know whether there's much I can do if I can't even replicate the bug on this machine, hah. I'll try running some bits of code earlier in the process, maybe that will help with something.

rafamadriz commented 3 years ago

Huh, what a weird bug. I ran your configuration through cheovim and would you know it, everything worked just fine. The ftplugin stuff worked exactly as I'd expect. This leads me to believe that maybe it's a timing issue? I have fairly fast hardware, and so maybe my buffer loads fast enough that the ftplugin has time to trigger? Although I don't know what specs you're running so that's a total shot in the dark. I'll try doing a bit more research, however I don't know whether there's much I can do if I can't even replicate the bug on this machine, hah. I'll try running some bits of code earlier in the process, maybe that will help with something.

I have a fairly recent CPU (Ryzen 3200g) that while not top end, I'd say that is more than enough to handle buffers in neovim, but who knows maybe you're right.

Also, I just installed once again to see if there was something wrong last time, but nop, settings in after/ftplugin.vim don't seem to be working.

Here the output of nvim --startuptime log without cheovim and notice that at line 22, after/ftplugin.vim is getting sourced.

Here the output of nvim --startuptime log with cheovim I don't see my after/ftplugin.vim anywhere, only the one system wide at line 21

Hope this is useful.

rafamadriz commented 3 years ago

@vhyrro I just tried this in another machine I have and it's the same behavior :(