Skip to content

excluding plugin loading based on file type in Neovim's Lazy Loading configuration #1260

Closed Answered by iton0
iton0 asked this question in Q&A
Discussion options

You must be logged in to vote

I was able to make an autocommand:

vim.api.nvim_create_autocmd({ 'BufReadPost', 'BufNewFile' }, {
  pattern = '*',
  callback = function()
    vim.defer_fn(function()
      local excluded_fts = function()
        local current_buf = vim.api.nvim_get_current_buf()
        local filename = vim.fn.fnamemodify(vim.fn.bufname(current_buf), ':t')
        local current_filetype =
          vim.api.nvim_buf_get_option(current_buf, 'filetype')

        -- Excluded filetype
        -- Can either add the filetype or file extensions
        -- ex. 'text' or 'txt'
        local filetypes = {
          'php',
          'gitcommit',
          'lazy',
          'TelescopePrompt',
          'gitconfig',
 …

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
3 replies
@iton0
Comment options

@dpetka2001
Comment options

@iton0
Comment options

Answer selected by iton0
Comment options

You must be logged in to vote
3 replies
@iton0
Comment options

@avidseeker
Comment options

@dpetka2001
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants