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

Fix telescope windows #28

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

droopy4096
Copy link

Recent updates made Telescope windows be picked up by winbar making things looking rather odd:

Screenshot_20241214_010347

turns out that that some can be picked by TelescopePrompt filetype but others have empty filetype and the only identyfying feature was term: first component of the path.

@droopy4096
Copy link
Author

trouble is that winbar does come up in "buf 2:" view after a few back-and-forth as well. So there must be some other way to identify that those are Telescope views and disable winbar there. filetype alone is not sufficient of an identifier. Also files that didn't get their type "guessed" by neovim may fall into the same category.

@droopy4096
Copy link
Author

@fgheng what do you think would be more appropriate here to catch Telescope views?

@droopy4096
Copy link
Author

I've had couple of ideas thus far:

  1. Filter out buffers who have file names associated with them but no actual file on-disk. This would take care of term:/ files, and some "artificial" buffers.

  2. Configure telescope to disable winbar upon entry and re-enable it after closure. I'm not familiar with Telescope codebase but if there are any hooks or events that could be leveraged - winbar would need to have a "toggle" that could be invoked to disable it temporarily for Telescope

@droopy4096
Copy link
Author

tried "fixing" it with overriding status when entering Telescope buffer:

vim.api.nvim_create_autocmd({'BufWinEnter','BufWinLeave'}, {
  callback = function(ev)
    local wb=require('winbar')
    if ev.event == 'BufWinEnter' then
      if vim.fn.filereadable(ev.file) then
        -- it's a real file
        local ft = vim.api.nvim_buf_get_name(ev.buf)
        if ft == 'TelescopePrompt' then
          -- disable winbar
          wb.setup({enable=false})
        end
      end
    elseif ev.event == 'BufWinEnter' then
      wb.setup({enable=true})
    end
  end
})

with no success

@droopy4096
Copy link
Author

After some tinkering I think I've arrived (by experimentation) at a combination of conditions that disables winbar for telescope windows.

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.

1 participant