diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/bracketmatch.lua | 14 | ||||
-rw-r--r-- | plugins/ghmarkdown.lua | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/plugins/bracketmatch.lua b/plugins/bracketmatch.lua index 4d1da37..b2c3f4e 100644 --- a/plugins/bracketmatch.lua +++ b/plugins/bracketmatch.lua @@ -36,6 +36,7 @@ end local state = {} +local select_adj = 0 local function update_state(line_limit) line_limit = line_limit or math.huge @@ -63,6 +64,8 @@ local function update_state(line_limit) local open = doc.lines[line]:byte(col) local close = map[open] if close then + -- i == 0 if the cursor is on the left side of a bracket (or -1 when on right) + select_adj = i + 1 -- if i == 0 then select_adj = 1 else select_adj = 0 end line2, col2 = get_matching_bracket(doc, line, col, line_limit, open, close, map.step) goto found end @@ -113,6 +116,15 @@ command.add("core.docview", { core.active_view.doc:set_selection(state.line2, state.col2) end end, + ["bracket-match:select-to-matching"] = function() + update_state() + if state.line2 then + core.active_view.doc:set_selection(state.line, state.col, state.line2, state.col2 + select_adj) + end + end, }) -keymap.add { ["ctrl+m"] = "bracket-match:move-to-matching" } +keymap.add { + ["ctrl+m"] = "bracket-match:move-to-matching", + ["ctrl+shift+m"] = "bracket-match:select-to-matching", +} diff --git a/plugins/ghmarkdown.lua b/plugins/ghmarkdown.lua index 7dcf3cb..532be57 100644 --- a/plugins/ghmarkdown.lua +++ b/plugins/ghmarkdown.lua @@ -71,4 +71,4 @@ command.add("core.docview", { }) -keymap.add { ["ctrl+shift+m"] = "ghmarkdown:show-preview" } +keymap.add { ["ctrl+alt+m"] = "ghmarkdown:show-preview" } |