feat: add new action to open quickfix window from quickfixhistory (#2249)

This commit is contained in:
kyoh86
2022-11-28 04:03:03 +09:00
committed by GitHub
parent cea9c75c19
commit 343a2b6b71
2 changed files with 9 additions and 2 deletions

View File

@@ -301,7 +301,7 @@ Built-in functions. Ready to be bound to any key you like.
| `builtin.marks` | Lists vim marks and their value |
| `builtin.colorscheme` | Lists available colorschemes and applies them on `<cr>` |
| `builtin.quickfix` | Lists items in the quickfix list |
| `builtin.quickfixhistory` | Lists all quickfix lists in your history and open them with `builtin.quickfix` |
| `builtin.quickfixhistory` | Lists all quickfix lists in your history and open them with `builtin.quickfix` or quickfix window |
| `builtin.loclist` | Lists items from the current window's location list |
| `builtin.jumplist` | Lists Jump List entries |
| `builtin.vim_options` | Lists vim options, allows you to edit the current value on `<cr>` |

View File

@@ -449,12 +449,19 @@ internal.quickfixhistory = function(opts)
end,
},
sorter = conf.generic_sorter(opts),
attach_mappings = function(_, _)
attach_mappings = function(_, map)
action_set.select:replace(function(prompt_bufnr)
local nr = action_state.get_selected_entry().nr
actions.close(prompt_bufnr)
internal.quickfix { nr = nr }
end)
map({ "i", "n" }, "<C-q>", function(prompt_bufnr)
local nr = action_state.get_selected_entry().nr
actions.close(prompt_bufnr)
vim.cmd(nr .. "chistory")
vim.cmd "copen"
end)
return true
end,
})