Install plugin: https://github.com/s1n7ax/nvim-window-picker
Create command:
vim.api.nvim_create_user_command("Pick", function (e)
local success, picked = pcall(function ()
return require('window-picker').pick_window({
autoselect_one = true,
include_current_win = true,
current_win_hl_color = '#89b4fa',
other_win_hl_color = '#89b4fa'
})
end)
if not success then
return
end
vim.api.nvim_set_current_win(picked)
if e.fargs[1] ~= nil then
vim.cmd('e ' .. e.fargs[1])
end
end, { nargs = '?', complete = 'file' })
Add mappings to telescope:
local action_set = require('telescope.actions.set')
require('telescope').setup {
defaults = {
mappings = {
i = {
["<S-CR>"] = function (prompt_bufnr)
action_set.edit(prompt_bufnr, "Pick")
end
},
n = {
["<S-CR>"] = function (prompt_bufnr)
action_set.edit(prompt_bufnr, "Pick")
end
},
},
},
}