gitcommit filetype not yet set on neovim
Some time ago neovim switched to use filetype.lua by default. I'm guessing that's the reason that git commit message the filetype isn't yet set on BufRead and BufReadPost, but after BufEnter. So the lastplace_ignore list doesn't work on neovim.
I don't know if you want to support that and change to autocmd, or if that breaks the opening fold for some reason. Just letting you know, feel free to close :)
Edit: never mind, using BufEnter is just plain wrong.
@saecki , thanks for the bug report! I have not been able to reproduce the bug. Could you provide some steps to reproduce it?
Here is what I tried:
I performed a couple of multi-line git commits and confirmed that it opens on the first line correctly. When I set g:lastplace_ignore="" then I could see that git commits would jump to the line number of the last edit because vim-lastplace wasn't disabled for git commits anymore.
I tested with neovim v0.9.5 with Lazy (plugin manager) and used this config to test:
-- File: ~/.config/nvim/lua/plugins/vim-lastplace.lua
return {
"farmergreg/vim-lastplace",
config = function()
vim.g.lastplace_ignore = "gitcommit,gitrebase,svn,hgcommit"
vim.g.lastplace_ignore_buftype = "quickfix,nofile,help"
vim.g.lastplace_open_folds = 1
end,
}
Interesting, I'm not sure what exactly lazy.nvim does, but when adding the following auto commands before the lazy setup vs after I get different results:
vim.api.nvim_create_autocmd("BufReadPre", {
callback = function()
print("BufReadPre:", vim.bo.ft)
end,
})
vim.api.nvim_create_autocmd("BufRead", {
callback = function()
print("BufRead:", vim.bo.ft)
end,
})
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function()
print("BufReadPost:", vim.bo.ft)
end,
})
before
BufReadPre:
BufRead:
BufReadPost:
after
BufReadPre:
BufRead: gitcommit
BufReadPost: gitcommit