comparison .chezmoitemplates/init.lua @ 719:08baa6419e7d

fix: pass vcs config to format-modifications attach function
author zegervdv <zegervdv@me.com>
date Tue, 06 Dec 2022 20:58:35 +0100
parents 451632dcb1dd
children 6d036fac4dbd
comparison
equal deleted inserted replaced
718:451632dcb1dd 719:08baa6419e7d
1140 local vcs = 'git' 1140 local vcs = 'git'
1141 if root then vcs = vim.fs.basename(root[1]):sub(2) end 1141 if root then vcs = vim.fs.basename(root[1]):sub(2) end
1142 1142
1143 vim.notify('Enabled modification formatting via ' .. vcs .. ' using ' .. client.name, vim.log.levels.INFO) 1143 vim.notify('Enabled modification formatting via ' .. vcs .. ' using ' .. client.name, vim.log.levels.INFO)
1144 local lsp_format_modifications = require 'lsp-format-modifications' 1144 local lsp_format_modifications = require 'lsp-format-modifications'
1145 lsp_format_modifications.attach(client, bufnr, { format_on_save = false, vcs = 'hg' }) 1145 lsp_format_modifications.attach(client, bufnr, { format_on_save = false, vcs = vcs })
1146 nmap('<c-p>', function() lsp_format_modifications.format_modifications_current_buffer() end) 1146 nmap('<c-p>', function() lsp_format_modifications.format_modifications_current_buffer() end)
1147 elseif client.supports_method 'textDocument/formatting' then 1147 elseif client.supports_method 'textDocument/formatting' then
1148 nmap('<c-p>', function() lsp_formatting(0) end) 1148 nmap('<c-p>', function() lsp_formatting(0) end)
1149 end 1149 end
1150 end 1150 end