Skip to content

Conversation

@evertonse
Copy link

Check if focus is disabled when changing signcolumn when leaving (WinLeave).

This solves the signcolumn getting changed upon lost focus of NvimTree window in floating mode despite being sure that NvimTree is in the ignore_filetypes.

    local ignore_filetypes = { 'neo-tree', 'NvimTree' }
    vim.api.nvim_create_autocmd('FileType', {
      group = augroup,
      callback = function(_)
        local is_floating = vim.api.nvim_win_get_config(0).relative ~= ''
        if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) or is_floating then
          vim.b.focus_disable = true
          print('recognized focus filetype = ' .. vim.bo.filetype)
        else
          vim.b.focus_disable = false
        end
      end,
      desc = 'Disable focus autoresize for FileType',
    })

Before

Signcolumn disappear after losing focus
image

After

Corectly keeps the signcolumn padding when cursor leaves NvimTree window
image

@cryptomilk
Copy link
Collaborator

Thank you very much for your contribution. Could you please add a test for it?

@cryptomilk
Copy link
Collaborator

Ping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants