From b7f8dd4bc038c7571cc941e6113a72063521fc2f Mon Sep 17 00:00:00 2001 From: Takayuki Hirayama Date: Wed, 15 Jun 2022 11:24:36 +0900 Subject: [PATCH] Apply user defined config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ユーザが定義したコンフィグを適用するよう修正 --- lua/trim/init.lua | 2 +- lua/trim/trimmer.lua | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/trim/init.lua b/lua/trim/init.lua index 9d2465f..1648e3e 100644 --- a/lua/trim/init.lua +++ b/lua/trim/init.lua @@ -25,7 +25,7 @@ M.setup = function(cfg) pattern = '*', callback = function() if not has_value(cfg.disable, vim.bo.filetype) then - require 'trim.trimmer'.trim() + require 'trim.trimmer'.trim(cfg.patterns) end end, group = 'TrimNvim' diff --git a/lua/trim/trimmer.lua b/lua/trim/trimmer.lua index 17b2e8e..c0415bc 100644 --- a/lua/trim/trimmer.lua +++ b/lua/trim/trimmer.lua @@ -1,12 +1,11 @@ local vim = vim local api = vim.api -local cfg = require 'trim.config' local trimmer = {} -trimmer.trim = function() +trimmer.trim = function(patterns) local save = vim.fn.winsaveview() - for _, v in pairs(cfg.patterns) do + for _, v in pairs(patterns) do api.nvim_exec(string.format("keepjumps keeppatterns silent! %s", v), false) end vim.fn.winrestview(save)