Ensure utf-8, 2s tabs in xml, change xml formatter
This commit is contained in:
@@ -10,6 +10,12 @@ local azurePipelineFileGlobs = {
|
|||||||
'Pipelines/*.y*l',
|
'Pipelines/*.y*l',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Set encodings:
|
||||||
|
-- ensure UTF-8 everywhere
|
||||||
|
vim.opt.encoding = 'utf-8'
|
||||||
|
vim.opt.fileencoding = 'utf-8'
|
||||||
|
vim.opt.fileencodings = { 'utf-8' }
|
||||||
|
|
||||||
-- "<leader>sh" to [s]earch the [h]elp documentation.
|
-- "<leader>sh" to [s]earch the [h]elp documentation.
|
||||||
|
|
||||||
-- Set <space> as the leader key
|
-- Set <space> as the leader key
|
||||||
@@ -659,6 +665,7 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
lemminx = {},
|
||||||
-- C# Csharp
|
-- C# Csharp
|
||||||
roslyn = {},
|
roslyn = {},
|
||||||
pylsp = {
|
pylsp = {
|
||||||
@@ -731,12 +738,11 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local conform = require('conform').setup {
|
local conform = require 'conform'
|
||||||
|
|
||||||
|
conform.setup {
|
||||||
notify_on_error = false,
|
notify_on_error = false,
|
||||||
format_on_save = function(bufnr)
|
format_on_save = function(bufnr)
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
|
||||||
-- have a well standardized coding style. You can add additional
|
|
||||||
-- languages here or re-enable it for the disabled ones.
|
|
||||||
local disable_filetypes = { c = true, cpp = true, vue = true }
|
local disable_filetypes = { c = true, cpp = true, vue = true }
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||||
return nil
|
return nil
|
||||||
@@ -747,13 +753,10 @@ require('lazy').setup({
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
--xml = { 'xmlformatter' }, -- USE CUSTOM FORMATTER
|
||||||
-- python = { "isort", "black" },
|
|
||||||
--
|
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
|
||||||
xml = { 'xmlformatter' },
|
|
||||||
python = { 'black', 'isort' },
|
python = { 'black', 'isort' },
|
||||||
json = { 'prettierd' },
|
json = { 'prettierd' },
|
||||||
},
|
},
|
||||||
@@ -1042,7 +1045,7 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- Autoindent json by 2 spaces
|
-- Autoindent json by 2 spaces
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'json',
|
pattern = { 'json', 'xml' },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.bo.shiftwidth = 2
|
vim.bo.shiftwidth = 2
|
||||||
vim.bo.tabstop = 2
|
vim.bo.tabstop = 2
|
||||||
|
|||||||
Reference in New Issue
Block a user