Skip to content

Commit

Permalink
make simple
Browse files Browse the repository at this point in the history
  • Loading branch information
Shu Kutsuzawa committed Sep 17, 2020
1 parent 1a67a87 commit b3d4d1c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lua/trim/init.lua
Original file line number Diff line number Diff line change
@@ -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(<q-args>, <line1>, <line2>)')
vim.cmd [=[command! -nargs=? -range=% -bang Trim lua require"trim.trimmer".trim(<q-args>, <line1>, <line2>)]=]

setAutocmd(o)
end
Expand All @@ -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

0 comments on commit b3d4d1c

Please sign in to comment.