feat(telescope): smarter way to determine the window to open a file in

This commit is contained in:
Folke Lemaitre
2023-10-09 20:11:45 +02:00
parent 5d44c976a7
commit c0ce89fe62

View File

@ -201,6 +201,19 @@ return {
defaults = {
prompt_prefix = "",
selection_caret = "",
-- open files in the first window that is an actual file.
-- use the current window if no other window is available.
get_selection_window = function()
local wins = vim.api.nvim_list_wins()
table.insert(wins, 1, vim.api.nvim_get_current_win())
for _, win in ipairs(wins) do
local buf = vim.api.nvim_win_get_buf(win)
if vim.bo[buf].buftype == "" then
return win
end
end
return 0
end,
mappings = {
i = {
["<c-t>"] = open_with_trouble,