exe picker more robust
This commit is contained in:
parent
d06e7b8f2d
commit
d2da11491d
2 changed files with 21 additions and 9 deletions
|
|
@ -27,6 +27,9 @@ local function pick_executable(start_dir)
|
|||
return
|
||||
end
|
||||
|
||||
local actions = require 'telescope.actions'
|
||||
local action_state = require 'telescope.actions.state'
|
||||
|
||||
require('telescope.pickers')
|
||||
.new({}, {
|
||||
prompt_title = 'Select Executable',
|
||||
|
|
@ -36,10 +39,18 @@ local function pick_executable(start_dir)
|
|||
sorter = require('telescope.config').values.generic_sorter {},
|
||||
attach_mappings = function(_, map)
|
||||
map('i', '<CR>', function(prompt_bufnr)
|
||||
local entry = require('telescope.actions.state').get_selected_entry()
|
||||
require('telescope.actions').close(prompt_bufnr)
|
||||
local entry = action_state.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
coroutine.resume(co, entry.value)
|
||||
end)
|
||||
map('i', '<Esc>', function(prompt_bufnr)
|
||||
actions.close(prompt_bufnr)
|
||||
coroutine.resume(co, nil)
|
||||
end)
|
||||
map('n', 'q', function(prompt_bufnr)
|
||||
actions.close(prompt_bufnr)
|
||||
coroutine.resume(co, nil)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue