From 29021babb40620189308e09e2970669e80d927a5 Mon Sep 17 00:00:00 2001 From: Hawtian Wang Date: Thu, 14 Dec 2023 13:43:38 +0800 Subject: [PATCH] fix all snippet --- lua/ht/snippets/all.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/ht/snippets/all.lua b/lua/ht/snippets/all.lua index c2b52df3..f02cce87 100644 --- a/lua/ht/snippets/all.lua +++ b/lua/ht/snippets/all.lua @@ -12,8 +12,10 @@ local todo_comment = function(keyword) f(function() local CommentFt = require("Comment.ft") local CommentU = require("Comment.utils") - local current_file = vim.fn.expand("%:p") - local pattern = CommentFt.get(current_file, CommentU.ctype.linewise) + local ft = vim.api.nvim_get_option_value("filetype", { + buf = 0, + }) + local pattern = CommentFt.get(ft, CommentU.ctype.linewise) if pattern == nil then -- keep the input pattern = "%s"