From b3d4d1c4a0f502b7072717b05e66c01ecbd2362b Mon Sep 17 00:00:00 2001 From: Shu Kutsuzawa Date: Thu, 17 Sep 2020 17:22:54 +0900 Subject: [PATCH] make simple --- lua/trim/init.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/trim/init.lua b/lua/trim/init.lua index a966425..9eb7730 100644 --- a/lua/trim/init.lua +++ b/lua/trim/init.lua @@ -1,10 +1,8 @@ local vim = vim -local cmd = vim.api.nvim_command - local M = {} function M.setup(o) - cmd('command! -nargs=? -range=% -bang Trim lua require"trim.trimmer".trim(, , )') + vim.cmd [=[command! -nargs=? -range=% -bang Trim lua require"trim.trimmer".trim(, , )]=] setAutocmd(o) end @@ -17,9 +15,10 @@ function setAutocmd(o) for _, v in pairs(disable) do table.insert(excepts, string.format("&filetype != '%s'", v)) end - cmd("augroup TrimNvim") - cmd(string.format("autocmd BufWritePre * if %s | Trim | endif", table.concat(excepts, " && "))) - cmd("augroup END") + vim.cmd [=[augroup TrimNvim]=] + vim.cmd [=[ autocmd!]=] + vim.cmd (string.format(" autocmd BufWritePre * if %s | Trim | endif", table.concat(excepts, " && "))) + vim.cmd [=[augroup END]=] end return M