docs: add festival configuration helper

This commit is contained in:
JuanZoran
2023-01-22 10:15:23 +08:00
parent d2e8db99c5
commit 0964a9c3c4
3 changed files with 54 additions and 13 deletions

View File

@@ -53,7 +53,9 @@ local content = {
local window = self.window
api.nvim_buf_set_lines(window.bufnr, offset, offset + 1, true, self.lines)
for _, hl in ipairs(self.highlights) do
local hl
for i = 1, self.hl_size do
hl = self.highlights[i]
api.nvim_buf_add_highlight(window.bufnr, window.hl, hl.name, offset + hl.line, hl._start, hl._end)
end
self.window:bufset('modifiable', false)

View File

@@ -175,15 +175,14 @@ local process = {
}
local cmd_id
local pin = false
local try_del_keymap = function()
for _, key in pairs(conf.hover.keymap) do
pcall(vim.keymap.del, 'n', key, { buffer = true })
end
end
local cmd_id
local pin = false
local action
local next
local _word
@@ -255,13 +254,11 @@ action = {
end
end,
play = function()
if vim.fn.has('linux') == 1 then
vim.fn.jobstart('echo ' .. _word .. ' | festival --tts')
else
local file = debug.getinfo(1, "S").source:sub(2):match('(.*)lua/') .. 'tts/say.js'
vim.fn.jobstart('node ' .. file .. ' ' .. _word)
end
play = vim.fn.has('linux') == 1 and function()
vim.fn.jobstart('echo ' .. _word .. ' | festival --tts')
end or function()
local file = debug.getinfo(1, "S").source:sub(2):match('(.*)lua/') .. 'tts/say.js'
vim.fn.jobstart('node ' .. file .. ' ' .. _word)
end,
}