nix/prog/nvim: restore old version of neoformat group

This commit is contained in:
Dmitriy Pleshevskiy 2022-08-19 16:36:49 +03:00
parent 8d4c99f8ae
commit ea7536542f
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -33,12 +33,27 @@ vim.g.neoformat_try_node_exe = 1
vim.g.neoformat_only_msg_on_error = 1 vim.g.neoformat_only_msg_on_error = 1
vim.g.neoformat_enabled_markdown = {"denofmt"} vim.g.neoformat_enabled_markdown = {"denofmt"}
vim.cmd [[
aug fmt
au!
au BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry
aug END
]]
--[[ TODO: need to investigate how implement it in lua
local format_augroup = vim.api.nvim_create_augroup('format', {}) local format_augroup = vim.api.nvim_create_augroup('format', {})
vim.api.nvim_create_autocmd('BufWritePre', { vim.api.nvim_create_autocmd('BufWritePre', {
pattern = '*', pattern = '*',
group = spell_check_augroup, group = spell_check_augroup,
callback = 'try | undojoin | NeoFormat | catch /E790/ | NeoFormat | endtry' callback = function ()
local ok, _ = pcall(function ()
vim.fn.undojoin();
vim.cmd'NeoFormat';
end)
if not ok then vim.cmd'NeoFormat' end
end
}) })
]]--
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- --