Mercurial > dotfiles
changeset 782:31605398117a
fix: handle opening files not under vcs
author | zegervdv <zegervdv@me.com> |
---|---|
date | Fri, 28 Apr 2023 07:12:49 +0200 |
parents | f8f28675afe7 |
children | 335b1f5c242d |
files | .chezmoitemplates/init.lua |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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'