Yilin-Yang / vim-markbar

Display all accessible marks and their surrounding lines in a collapsible sidebar.
MIT License
191 stars 3 forks source link

Run `filetype detect` when caching files in hidden buffers #60

Closed Yilin-Yang closed 4 months ago

Yilin-Yang commented 4 months ago

When running the following steps, the given file will open without a detected filetype and without syntax highlighting:

  1. Open foo.txt in vim (nvim foo.txt)
  2. Exit vim.
  3. Reopen vim (nvim)
  4. Manually reload foo.txt (:edit foo.txt)

The issue arises because of this line in markbar#helpers#FetchBufferLineRange():

silent execute 'tabnew ' . l:filename . ' | hide'

Changing this to:

silent execute 'tabnew ' . l:filename . ' | filetype detect | hide'

Fixes syntax highlighting.

Closes #59.

Yilin-Yang commented 4 months ago

Hi @Arnie97,

I went ahead and merged the changes because it seems to fix the issue on my end, but could you double check and make sure that things work for you now? I appreciate your help!

Arnie97 commented 4 months ago

Thank you for your development and maintenance efforts! I can confirm the reported issues are all fixed on the master branch.

Arnie97 commented 4 months ago

I've just found that let g:markbar_cache_with_hidden_buffers = v:true (now the default value) breaks the syntax highlighting of markbar itself. Can you reproduce this?

Yilin-Yang commented 4 months ago

Not able to reproduce this on my end 😟; could you let me know what plugin settings you're using, and/or give repro steps?