Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

feat: option to apply a function to all file types #28

Closed
wants to merge 2 commits into from

Conversation

aspeddro
Copy link
Contributor

@aspeddro aspeddro commented Oct 7, 2021

#25

@nathom
Copy link
Owner

nathom commented Oct 7, 2021

What's the purpose of this? If there is a setting you want to apply to all filetypes, just put it in your init.lua. Also, I'm not sure what setting formatoptions has to do with this plugin.

@aspeddro
Copy link
Contributor Author

aspeddro commented Oct 7, 2021

The idea is that I can set specific option for file type. formatoptions is not respected when placed in init.lua or .vimrc. I would need to configure each type in ~/.config/nvim/after/ftplugin/<type>.vim or create a autocommand

require'filetype'.setup{
  extra_function = {
    all = function ()
      if vim.bo.filetype == 'lua' then
        vim.bo.shiftwidth = 4
        vim.bo.formatoptions = "jql"
      end
    end,
  }
}

vim/vim#4680

@nathom
Copy link
Owner

nathom commented Oct 8, 2021

The behavior you're suggesting has nothing do with the purpose of this plugin, which is to set the filetype option to the appropriate value. The best option for you would be to create an auto command in your config for FileType *.

@nathom nathom closed this Oct 8, 2021
@nathom nathom mentioned this pull request Oct 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants