gp.nvim icon indicating copy to clipboard operation
gp.nvim copied to clipboard

fix: set the popup window to markdown filetype

Open XXiaoA opened this issue 10 months ago • 3 comments

XXiaoA avatar Apr 06 '24 03:04 XXiaoA

This has a side effect. It applies the markdown type to not only popup windows but also the search bar in :GpChatFinder, which is created by the create_popup() function in the same way as popup windows.

I think a more proper solution would be to move the vim.api.nvim_buf_set_option(buf, "filetype", "markdown") to just below the 0read file_name line in the open_buf() function.

The popup for :GpChatNew works differently than other targets. :GpChatNew <target> first creates a .md file containing the template, and then uses the open_buf() function to read it in. When reading the template.md, all targets (split, vsplit, tabnew) except for popup simply open it, and the filetype is detected by checking the file name. The popup target, however, creates a new window and copy-pastes the content from the template.md, and the filetype is not detected and left empty.

tanloong avatar Apr 06 '24 14:04 tanloong

@tanloong Yeah, it was my mistake. I browsed the code base again and find it you are right. Thanks!

XXiaoA avatar Apr 12 '24 10:04 XXiaoA

I ran the git rebase, so that we only have one commit

XXiaoA avatar Apr 12 '24 11:04 XXiaoA