如何在 Neovim 中为 git 提交定义文件类型插件?

问题描述 投票:0回答:1

我想在编辑 git 提交时设置

textwidth=72
。如何在 Neovim 中加载 git commit ftplugin?我尝试定义
ftplugin/gitcommit.lua
文件,但没有效果。 (同一文件夹中的其他 ftplugins 按预期工作。)

git vim neovim
1个回答
0
投票

我的旧 Vim 配置中有这个:

au BufRead */COMMIT_EDITMSG set tw=72

使用 lua,看起来像这样:

vim.api.nvim_create_autocmd({ "BufEnter" }, {
  pattern = {
    "*/COMMIT_EDITMSG",
  },
  command = "set tw=72",
})
© www.soinside.com 2019 - 2024. All rights reserved.