0

Currently I'm using the following vim autocmd to show the cursorline only in active pane (i.e. current buffer) as follows.

augroup CursorLine
    au!
    au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
    au WinLeave * setlocal nocursorline
augroup END

But it's also showing cursorline in plugin-related-buffers since it's forcing to set cursorline in current-buffer with WinEnter. For example, there's cursorline in search box of Telescope Find Files as shown in the picture below.

Cursorline in text input box

I tried to hide cursorline just only for Telescope plugin with ‌autocmd VimEnter,WinEnter,BufWinEnter Telescope* setlocal nocursorline and it doesn't work, cursorline is still appearing.

So, is there any workaround to avoid this issue?

Thanks in advance.

Edit: 1. I just tried an experiment autocmd VimEnter,WinEnter,BufWinEnter NvimTree* setlocal nocursorline and cursorline in NvimTree plugin has disappeared as I wanted. So, why isn't this working in Telescope?? Or do we need to address the issue in different way??

Edit 2. I just tried using TelescopePrompt instead of Telescope and it didn't work.

1 Answers1

2

Use FileType in your autocmd to disable cursorline for Telescope plugin :

au FileType Telescope setlocal nocursorline

You can also use the same configuration for your other plugin-related-buffers.

lcheylus
  • 1,217
  • 8
  • 21
  • 3
    I just did as you mentioned above and it worked. I just needed to change the file type to `TelescopePrompt*` instead of just `Telescope`. So the autocmd will be: `au FileType TelescopePrompt* setlocal nocursorline`. Thank you very much for the solution bruh. – Minmin Khant Sep 29 '22 at 05:01