From 2869e5b244c50b3345a226677e0b200ef4890169 Mon Sep 17 00:00:00 2001 From: inkch Date: Tue, 12 Mar 2024 12:58:48 +0900 Subject: [PATCH] nvim: add autocmd to guess and set filetype for .tmpl (for chezmoi) --- dot_config/nvim/lua/utils/chezmoi-tmpl.lua | 1 + dot_config/nvim/lua/utils/init.lua | 1 + 2 files changed, 2 insertions(+) create mode 100644 dot_config/nvim/lua/utils/chezmoi-tmpl.lua diff --git a/dot_config/nvim/lua/utils/chezmoi-tmpl.lua b/dot_config/nvim/lua/utils/chezmoi-tmpl.lua new file mode 100644 index 0000000..068646a --- /dev/null +++ b/dot_config/nvim/lua/utils/chezmoi-tmpl.lua @@ -0,0 +1 @@ +vim.cmd([[ autocmd BufNewFile,BufRead *.tmpl execute 'set filetype='..matchlist(expand(''), '.*\.\(.*\)\.tmpl$')[1] ]]) diff --git a/dot_config/nvim/lua/utils/init.lua b/dot_config/nvim/lua/utils/init.lua index aa3d945..ef26b41 100644 --- a/dot_config/nvim/lua/utils/init.lua +++ b/dot_config/nvim/lua/utils/init.lua @@ -1,3 +1,4 @@ require("utils.zenkaku") require("utils.trim") require("utils.setindent") +require("utils.chezmoi-tmpl")