feat(actions): support scrolling and selecting with the mouse (#2687)

* feat(scrolling and mouse support): support scrolling and selecting with the mouse

* fix ascending sorting_strategy mouse clicks

---------

Co-authored-by: James Trew <j.trew10@gmail.com>
This commit is contained in:
Sofronie Cristian
2024-03-30 04:05:03 +00:00
committed by GitHub
co-authored by James Trew
parent b22e6f6896
commit 1bb28df3cf
3 changed files with 150 additions and 1 deletions
+62 -1
View File
@@ -133,6 +133,37 @@ local mappings = {}
mappings.default_mappings = config.values.default_mappings
or {
i = {
["<ScrollWheelDown>"] = {
actions.mouse_scroll_up,
type = "action",
opts = { expr = true },
},
["<ScrollWheelUp>"] = {
actions.mouse_scroll_down,
type = "action",
opts = { expr = true },
},
["<ScrollWheelLeft>"] = {
actions.mouse_scroll_right,
type = "action",
opts = { expr = true },
},
["<ScrollWheelRight>"] = {
actions.mouse_scroll_left,
type = "action",
opts = { expr = true },
},
["<LeftMouse>"] = {
actions.mouse_click,
type = "action",
opts = { expr = true },
},
["<2-LeftMouse>"] = {
actions.double_mouse_click,
type = "action",
opts = { expr = true },
},
["<C-n>"] = actions.move_selection_next,
["<C-p>"] = actions.move_selection_previous,
@@ -169,8 +200,38 @@ mappings.default_mappings = config.values.default_mappings
-- disable c-j because we dont want to allow new lines #2123
["<C-j>"] = actions.nop,
},
n = {
["<ScrollWheelDown>"] = {
actions.mouse_scroll_up,
type = "action",
opts = { expr = true },
},
["<ScrollWheelUp>"] = {
actions.mouse_scroll_down,
type = "action",
opts = { expr = true },
},
["<ScrollWheelLeft>"] = {
actions.mouse_scroll_right,
type = "action",
opts = { expr = true },
},
["<ScrollWheelRight>"] = {
actions.mouse_scroll_left,
type = "action",
opts = { expr = true },
},
["<LeftMouse>"] = {
actions.mouse_click,
type = "action",
opts = { expr = true },
},
["<2-LeftMouse>"] = {
actions.double_mouse_click,
type = "action",
opts = { expr = true },
},
["<esc>"] = actions.close,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,