# HG changeset patch # User zegervdv # Date 1682658769 -7200 # Node ID 31605398117aa7de85ea6124d7d0939aa2f4f879 # Parent f8f28675afe740b7db79f127872e48481ea96b09 fix: handle opening files not under vcs diff -r f8f28675afe7 -r 31605398117a .chezmoitemplates/init.lua --- a/.chezmoitemplates/init.lua Mon Apr 24 21:22:30 2023 +0000 +++ b/.chezmoitemplates/init.lua Fri Apr 28 07:12:49 2023 +0200 @@ -1194,7 +1194,7 @@ if client.supports_method 'textDocument/rangeFormatting' then local root = vim.fs.find({ '.git', '.hg' }, { path = client.config.root_dir }) local vcs = 'git' - if root then vcs = vim.fs.basename(root[1]):sub(2) end + if root and #root > 0 then vcs = vim.fs.basename(root[1]):sub(2) end vim.notify('Enabled modification formatting via ' .. vcs .. ' using ' .. client.name, vim.log.levels.INFO) local lsp_format_modifications = require 'lsp-format-modifications'