Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Weird interaction with oil.nvim #978

Open
1 task done
Sofistico opened this issue Nov 14, 2024 · 0 comments
Open
1 task done

[Bug]: Weird interaction with oil.nvim #978

Sofistico opened this issue Nov 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Sofistico
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

The issue is that when the bufferline.nvim diagnostics options is true, and there is one more than one buffer open, there is a massive slowdown to create/move/delete any file on oil buffer, i believe it is because bufferline tries to check if there is any diagnostic to show on the oil buffer, which causes the slowdown.

There is some more context on this reddit post that i made some time ago:
https://www.reddit.com/r/neovim/comments/1ge0lzp/comment/lu8q5p7/

This is my config on bufferline that i used when the error happened:

What did you expect to happen?

The expected behaviour is that there is no diagnostic to be run on the oil buffer, maybe a options to pass on what filetype it shouldn't try to run the diagnostics on.

Config

return {
  -- This is what powers LazyVim's fancy-looking
  -- tabs, which include filetype icons and close buttons.
  {
    'akinsho/bufferline.nvim',
    event = 'BufAdd',
    keys = {
      { '<leader>bp', '<Cmd>BufferLineTogglePin<CR>', desc = 'Toggle Pin' },
      { '<leader>bP', '<Cmd>BufferLineGroupClose ungrouped<CR>', desc = 'Delete Non-Pinned Buffers' },
      { '<leader>bo', '<Cmd>BufferLineCloseOthers<CR>', desc = 'Delete Other Buffers' },
      { '<leader>br', '<Cmd>BufferLineCloseRight<CR>', desc = 'Delete Buffers to the Right' },
      { '<leader>bl', '<Cmd>BufferLineCloseLeft<CR>', desc = 'Delete Buffers to the Left' },
      { '<S-h>', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
      { '<S-l>', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
      { '[b', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
      { ']b', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
      { '[B', '<cmd>BufferLineMovePrev<cr>', desc = 'Move buffer prev' },
      { ']B', '<cmd>BufferLineMoveNext<cr>', desc = 'Move buffer next' },
    },
    opts = {
      options = {
        diagnostics = 'nvim_lsp',
        always_show_bufferline = false,
        diagnostics_indicator = function(_, _, diag)
          local icons = require('local-icons').diagnostics
          local ret = (diag.error and icons.Error .. diag.error .. ' ' or '') .. (diag.warning and icons.Warn .. diag.warning or '')
          return vim.trim(ret)
        end,
        offsets = {
          {
            filetype = 'neo-tree',
            text = 'Neo-tree',
            highlight = 'Directory',
            text_align = 'left',
          },
        },
      },
    },
  },
  {
    'stevearc/oil.nvim',
    lazy = true,
    dependencies = { 'nvim-tree/nvim-web-devicons' },
    opts = {
      delete_to_trash = true,
      skip_confirm_for_simple_edits = true,
      watch_for_changes = false,
      view_options = {
        show_hidden = true,
      },
      lsp_file_methods = {
        enabled = false,
        timeout_ms = 1,
        -- autosave_changes = true,
      },
      keymaps = {
        ['gw'] = {
          function()
            require('oil').save(nil, nil)
          end,
          desc = 'Save Oil Buffer',
        },
        ['<leader>sF'] = {
          function()
            require('telescope.builtin').find_files {
              cwd = require('oil').get_current_dir(),
            }
          end,
          mode = 'n',
          nowait = true,
          desc = 'Find files in the current oil directory',
        },
        ['<C-k>'] = 'actions.select',
      },
    },
    -- config = function ()
    --   require("oil").setup()
    -- end,
    keys = {
      { '-', '<cmd>Oil<cr>', desc = 'Open parent directory' },
      {
        '_',
        function()
          require('oil').toggle_float()
        end,
        desc = 'Open floating parent direc',
      },
    },
  },
}

Additional Information

No response

commit

No response

@Sofistico Sofistico added the bug Something isn't working label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant