mirror of
https://github.com/kossLAN/nvim-flake.git
synced 2025-11-05 02:09:49 -05:00
nvim/qml: disable autoformatting script (needs fixing evidently)
This commit is contained in:
parent
01444ab8a5
commit
7b7a08e71c
1 changed files with 21 additions and 21 deletions
|
|
@ -4,24 +4,24 @@ end
|
||||||
|
|
||||||
-- Stupid conform doesn't support qmlformat, and I don't want to download a
|
-- Stupid conform doesn't support qmlformat, and I don't want to download a
|
||||||
-- whole new fucking plugin so uh yea this is it ig.
|
-- whole new fucking plugin so uh yea this is it ig.
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
-- vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
pattern = '*.qml',
|
-- pattern = '*.qml',
|
||||||
callback = function()
|
-- callback = function()
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
-- local bufnr = vim.api.nvim_get_current_buf()
|
||||||
local filename = vim.api.nvim_buf_get_name(bufnr)
|
-- local filename = vim.api.nvim_buf_get_name(bufnr)
|
||||||
local cmd = string.format('qmlformat -i "%s"', filename)
|
-- local cmd = string.format('qmlformat -i "%s"', filename)
|
||||||
|
--
|
||||||
local output = vim.fn.system(cmd)
|
-- local output = vim.fn.system(cmd)
|
||||||
local error_code = vim.v.shell_error
|
-- local error_code = vim.v.shell_error
|
||||||
|
--
|
||||||
if error_code ~= 0 then
|
-- if error_code ~= 0 then
|
||||||
vim.notify(
|
-- vim.notify(
|
||||||
string.format('qmlformat failed (code %d):\nCommand: %s\nOutput: %s', error_code, cmd, output),
|
-- string.format('qmlformat failed (code %d):\nCommand: %s\nOutput: %s', error_code, cmd, output),
|
||||||
vim.log.levels.ERROR
|
-- vim.log.levels.ERROR
|
||||||
)
|
-- )
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'modified', false)
|
-- vim.api.nvim_buf_set_option(bufnr, 'modified', false)
|
||||||
vim.cmd('edit!')
|
-- vim.cmd('edit!')
|
||||||
end,
|
-- end,
|
||||||
})
|
-- })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue