feat(loclist): use `alt-l` to send selection to the loclist (#435)

main
bhagwan 2 years ago
parent c8d0a0274e
commit d59bc58328

@ -451,6 +451,7 @@ require'fzf-lua'.setup {
["ctrl-v"] = actions.file_vsplit,
["ctrl-t"] = actions.file_tabedit,
["alt-q"] = actions.file_sel_to_qf,
["alt-l"] = actions.file_sel_to_ll,
},
buffers = {
-- providers that inherit these actions:
@ -748,8 +749,9 @@ require'fzf-lua'.setup {
},
-- actions inherit from 'actions.buffers' and merge
actions = {
["default"] = { actions.buf_edit_or_qf },
["alt-q"] = { actions.buf_sel_to_qf }
["default"] = actions.buf_edit_or_qf,
["alt-q"] = actions.buf_sel_to_qf,
["alt-l"] = actions.buf_sel_to_ll
},
},
blines = {
@ -765,8 +767,9 @@ require'fzf-lua'.setup {
},
-- actions inherit from 'actions.buffers' and merge
actions = {
["default"] = { actions.buf_edit_or_qf },
["alt-q"] = { actions.buf_sel_to_qf }
["default"] = actions.buf_edit_or_qf,
["alt-q"] = actions.buf_sel_to_qf,
["alt-l"] = actions.buf_sel_to_ll
},
},
tags = {

@ -490,6 +490,7 @@ open an issue and I'll be more than happy to help.**
["ctrl-v"] = actions.file_vsplit,
["ctrl-t"] = actions.file_tabedit,
["alt-q"] = actions.file_sel_to_qf,
["alt-l"] = actions.file_sel_to_ll,
},
buffers = {
-- providers that inherit these actions:
@ -787,8 +788,9 @@ open an issue and I'll be more than happy to help.**
},
-- actions inherit from 'actions.buffers' and merge
actions = {
["default"] = { actions.buf_edit_or_qf },
["alt-q"] = { actions.buf_sel_to_qf }
["default"] = actions.buf_edit_or_qf,
["alt-q"] = actions.buf_sel_to_qf,
["alt-l"] = actions.buf_sel_to_ll
},
},
blines = {
@ -804,8 +806,9 @@ open an issue and I'll be more than happy to help.**
},
-- actions inherit from 'actions.buffers' and merge
actions = {
["default"] = { actions.buf_edit_or_qf },
["alt-q"] = { actions.buf_sel_to_qf }
["default"] = actions.buf_edit_or_qf,
["alt-q"] = actions.buf_sel_to_qf,
["alt-l"] = actions.buf_sel_to_ll
},
},
tags = {

@ -157,7 +157,7 @@ M.file_open_in_background = function(selected, opts)
M.vimcmd_file(vimcmd, selected, opts)
end
M.file_sel_to_qf = function(selected, opts)
local sel_to_qf = function(selected, opts, is_loclist)
local qf_list = {}
for i = 1, #selected do
local file = path.entry_to_file(selected[i], opts)
@ -169,8 +169,21 @@ M.file_sel_to_qf = function(selected, opts)
text = text,
})
end
vim.fn.setqflist(qf_list)
vim.cmd 'copen'
if is_loclist then
vim.fn.setloclist(0, qf_list)
vim.cmd 'lopen'
else
vim.fn.setqflist(qf_list)
vim.cmd 'copen'
end
end
M.file_sel_to_qf = function(selected, opts)
sel_to_qf(selected, opts)
end
M.file_sel_to_ll = function(selected, opts)
sel_to_qf(selected, opts, true)
end
M.file_edit_or_qf = function(selected, opts)
@ -298,7 +311,11 @@ M.buf_switch_or_edit = function(...)
end
M.buf_sel_to_qf = function(selected, opts)
return M.file_sel_to_qf(selected, opts)
return sel_to_qf(selected, opts)
end
M.buf_sel_to_ll = function(selected, opts)
return sel_to_qf(selected, opts, true)
end
M.buf_edit_or_qf = function(selected, opts)

@ -126,6 +126,7 @@ M.globals = {
["ctrl-v"] = actions.file_vsplit,
["ctrl-t"] = actions.file_tabedit,
["alt-q"] = actions.file_sel_to_qf,
["alt-l"] = actions.file_sel_to_ll,
},
buffers = {
["default"] = actions.buf_edit,
@ -393,7 +394,8 @@ M.globals.lines = {
_actions = function() return M.globals.actions.buffers end,
actions = {
["default"] = actions.buf_edit_or_qf,
["alt-q"] = actions.buf_sel_to_qf
["alt-q"] = actions.buf_sel_to_qf,
["alt-l"] = actions.buf_sel_to_ll
},
}
M.globals.blines = {
@ -411,7 +413,8 @@ M.globals.blines = {
_actions = function() return M.globals.actions.buffers end,
actions = {
["default"] = actions.buf_edit_or_qf,
["alt-q"] = actions.buf_sel_to_qf
["alt-q"] = actions.buf_sel_to_qf,
["alt-l"] = actions.buf_sel_to_ll
},
}
M.globals.tags = {
@ -990,11 +993,13 @@ M._action_to_helpstr = {
[actions.file_vsplit] = "file-vsplit",
[actions.file_tabedit] = "file-tabedit",
[actions.file_sel_to_qf] = "file-selection-to-qf",
[actions.file_sel_to_ll] = "file-selection-to-loclist",
[actions.file_switch] = "file-switch",
[actions.file_switch_or_edit] = "file-switch-or-edit",
[actions.buf_edit] = "buffer-edit",
[actions.buf_edit_or_qf] = "buffer-edit-or-qf",
[actions.buf_sel_to_qf] = "buffer-selection-to-qf",
[actions.buf_sel_to_ll] = "buffer-selection-to-loclist",
[actions.buf_split] = "buffer-split",
[actions.buf_vsplit] = "buffer-vsplit",
[actions.buf_tabedit] = "buffer-tabedit",

Loading…
Cancel
Save