Skip to content

Commit

Permalink
fix: avoid custom autocmd conflicts with the help popup buffer
Browse files Browse the repository at this point in the history
Issue
=====

If the user has set up custom autocmds that trigger for `help` buffers,
the yazi.nvim help popup buffer will be affected by them. I noticed this
after setting the following autocmd:

```lua
vim.api.nvim_create_autocmd("FileType", {
  -- always open help buffers in a vertical split
  pattern = { "help", "man" },
  command = "wincmd L",
})
```

Solution
========

Only use the `syntax` option to set the filetype of the help buffer to
`help`. This way, the user's custom autocmds will not affect the help
popup buffer.
  • Loading branch information
mikavilpas committed Sep 12, 2024
1 parent 2135e8d commit e0239ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/yazi/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function M.set_keymappings(yazi_buffer, config, context)
"version *" .. require("yazi").version .. "*",
})

vim.api.nvim_set_option_value("filetype", "help", { buf = help_buffer })
vim.api.nvim_set_option_value("syntax", "help", { buf = help_buffer })
vim.api.nvim_set_option_value("modifiable", false, { buf = help_buffer })

local function close_help()
Expand Down

0 comments on commit e0239ad

Please sign in to comment.