feat(previewer): use treesitter for highlights, regex fallback (#2971)
* don't force regex highlighting * forwards opts
This commit is contained in:
@@ -711,7 +711,7 @@ previewers.help = defaulter(function(opts)
|
|||||||
winid = self.state.winid,
|
winid = self.state.winid,
|
||||||
preview = opts.preview,
|
preview = opts.preview,
|
||||||
callback = function(bufnr)
|
callback = function(bufnr)
|
||||||
putils.regex_highlighter(bufnr, "help")
|
putils.highlighter(bufnr, "help", opts)
|
||||||
search_cb_jump(self, bufnr, query)
|
search_cb_jump(self, bufnr, query)
|
||||||
end,
|
end,
|
||||||
file_encoding = opts.file_encoding,
|
file_encoding = opts.file_encoding,
|
||||||
@@ -738,7 +738,7 @@ previewers.man = defaulter(function(opts)
|
|||||||
value = entry.value .. "/" .. entry.section,
|
value = entry.value .. "/" .. entry.section,
|
||||||
bufname = self.state.bufname,
|
bufname = self.state.bufname,
|
||||||
})
|
})
|
||||||
putils.regex_highlighter(self.state.bufnr, "man")
|
putils.highlighter(self.state.bufnr, "man", opts)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
@@ -838,7 +838,7 @@ previewers.git_stash_diff = defaulter(function(opts)
|
|||||||
cwd = opts.cwd,
|
cwd = opts.cwd,
|
||||||
callback = function(bufnr)
|
callback = function(bufnr)
|
||||||
if vim.api.nvim_buf_is_valid(bufnr) then
|
if vim.api.nvim_buf_is_valid(bufnr) then
|
||||||
putils.regex_highlighter(bufnr, "diff")
|
putils.highlighter(bufnr, "diff", opts)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@@ -868,7 +868,7 @@ previewers.git_commit_diff_to_parent = defaulter(function(opts)
|
|||||||
callback = function(bufnr)
|
callback = function(bufnr)
|
||||||
if vim.api.nvim_buf_is_valid(bufnr) then
|
if vim.api.nvim_buf_is_valid(bufnr) then
|
||||||
search_cb_jump(self, bufnr, opts.current_line)
|
search_cb_jump(self, bufnr, opts.current_line)
|
||||||
putils.regex_highlighter(bufnr, "diff")
|
putils.highlighter(bufnr, "diff", opts)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@@ -899,7 +899,7 @@ previewers.git_commit_diff_to_head = defaulter(function(opts)
|
|||||||
callback = function(bufnr)
|
callback = function(bufnr)
|
||||||
if vim.api.nvim_buf_is_valid(bufnr) then
|
if vim.api.nvim_buf_is_valid(bufnr) then
|
||||||
search_cb_jump(self, bufnr, opts.current_line)
|
search_cb_jump(self, bufnr, opts.current_line)
|
||||||
putils.regex_highlighter(bufnr, "diff")
|
putils.highlighter(bufnr, "diff", opts)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@@ -930,7 +930,7 @@ previewers.git_commit_diff_as_was = defaulter(function(opts)
|
|||||||
callback = function(bufnr)
|
callback = function(bufnr)
|
||||||
if vim.api.nvim_buf_is_valid(bufnr) then
|
if vim.api.nvim_buf_is_valid(bufnr) then
|
||||||
search_cb_jump(self, bufnr, opts.current_line)
|
search_cb_jump(self, bufnr, opts.current_line)
|
||||||
putils.regex_highlighter(bufnr, ft)
|
putils.highlighter(bufnr, ft, opts)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@@ -1000,7 +1000,7 @@ previewers.git_file_diff = defaulter(function(opts)
|
|||||||
cwd = opts.cwd,
|
cwd = opts.cwd,
|
||||||
callback = function(bufnr)
|
callback = function(bufnr)
|
||||||
if vim.api.nvim_buf_is_valid(bufnr) then
|
if vim.api.nvim_buf_is_valid(bufnr) then
|
||||||
putils.regex_highlighter(bufnr, "diff")
|
putils.highlighter(bufnr, "diff", opts)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user