Can't override filetype on neovim

Hi :wave:

I’m using programs.neovim to set up my neovim, but having a small issue:
I’ve defined:

      customRC = ''
        source ~/.config/nvim/nix.vim
      '';

To import my full configuration, which works (the color scheme, custom commands etc. are all applied), except “filetype” definitions. E.g. I have following line in my config file:

autocmd FileType puppet setlocal shiftwidth=4 tabstop=4 sts=4 expandtab

which should set tab width to 4 spaces on puppet files, doesn’t work. Weird thing is, if I manually run :source ~/.config/nvim/nix.vim, it starts working :thinking:

Running :verbose setlocal ts? sts? et? sw? gives me:

  tabstop=2
        Last set from /nix/store/0aj802y5sb7sw1qjjk2z2gx2jwkdjggb-vimplugin-vim-puppet-2021-01-30/share/vim-plugins/vim-puppet/ftplugin/p
uppet.vim line 12
  softtabstop=2
        Last set from /nix/store/0aj802y5sb7sw1qjjk2z2gx2jwkdjggb-vimplugin-vim-puppet-2021-01-30/share/vim-plugins/vim-puppet/ftplugin/p
uppet.vim line 13
  expandtab
        Last set from /nix/store/0aj802y5sb7sw1qjjk2z2gx2jwkdjggb-vimplugin-vim-puppet-2021-01-30/share/vim-plugins/vim-puppet/ftplugin/p
uppet.vim line 15
  shiftwidth=2
        Last set from /nix/store/0aj802y5sb7sw1qjjk2z2gx2jwkdjggb-vimplugin-vim-puppet-2021-01-30/share/vim-plugins/vim-puppet/ftplugin/p
uppet.vim line 14

Which means my line is never evaluated on first load?

Could there be an ordering problem where “customRC” is applied, can I do something to dig further?

Related part of my config is here.

Thanks for any help/tip!

Not really a full answer, but in the original Vim using autocmd to set ft-specific options fails sometimes, and it’s recommended to use ~/.vim/after/ftplugin/puppet.vim in your case. Not sure how to handle it in a declarative setup though.

Well, I’ve forked the plugin, modified it & used that instead. Easier, I guess :slightly_smiling_face:

Relevant discusison: Neovim: override vimrc based on filetype with ftplugin? : NixOS

Thanks, but I can’t see programs.neovim.plugins option on available options. I guess it’s a home-manager thing.