12345678910111213141516171819202122232425262728293031323334353637383940 |
- local M = {}
- function M.resolve_git_path(buf_id)
- local bufname = vim.api.nvim_buf_get_name(buf_id)
- if not vim.startswith(bufname, 'fugitive://') then
- return false
- end
- local parsed = vim.fn.FugitiveParse(bufname)
- local resolved_path = parsed[1]
- local repo = parsed[2]
- if resolved_path == '' then
- return false
- end
- local parts = vim.split(resolved_path, ':')
- local commit = parts[1]
- local path = parts[2]
- return {
- repo = repo,
- commit = commit,
- path = path,
- }
- end
- function M.read_helix_config()
- local tinytoml = require('tinytoml')
- local data = vim.secure.read('.helix/languages.toml')
- if data ~= nil then
- local status, data = pcall(tinytoml.parse, data, { load_from_string = true })
- if status then
- return data
- end
- end
- return {}
- end
- return M
|