Ensure utf-8, 2s tabs in xml, change xml formatter
This commit is contained in:
@@ -10,6 +10,12 @@ local azurePipelineFileGlobs = {
|
||||
'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.
|
||||
|
||||
-- Set <space> as the leader key
|
||||
@@ -659,6 +665,7 @@ require('lazy').setup({
|
||||
},
|
||||
},
|
||||
},
|
||||
lemminx = {},
|
||||
-- C# Csharp
|
||||
roslyn = {},
|
||||
pylsp = {
|
||||
@@ -731,12 +738,11 @@ require('lazy').setup({
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local conform = require('conform').setup {
|
||||
local conform = require 'conform'
|
||||
|
||||
conform.setup {
|
||||
notify_on_error = false,
|
||||
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 }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
@@ -747,13 +753,10 @@ require('lazy').setup({
|
||||
}
|
||||
end
|
||||
end,
|
||||
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
xml = { 'xmlformatter' },
|
||||
--xml = { 'xmlformatter' }, -- USE CUSTOM FORMATTER
|
||||
python = { 'black', 'isort' },
|
||||
json = { 'prettierd' },
|
||||
},
|
||||
@@ -1042,7 +1045,7 @@ require('lazy').setup({
|
||||
|
||||
-- Autoindent json by 2 spaces
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'json',
|
||||
pattern = { 'json', 'xml' },
|
||||
callback = function()
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.tabstop = 2
|
||||
|
||||
Reference in New Issue
Block a user