haberdashPI / vscode-master-key

Master your keybindings with documentation, discoverability, modal bindings, macros and expressive configuration
Other
7 stars 1 forks source link

Larkin Bindings: remove bad bindings, add some new ones #25

Closed haberdashPI closed 2 months ago

haberdashPI commented 2 months ago

This is a hodge podge of improvements to the Larkin bindings:

  1. Adds ctrl+p for paste in insert mode
  2. Adds ctrl+d/u for page up down in insert mode
  3. Changes ; behavior to ignore the shrink selections motion when getting the last motion
  4. Removed comment-navigation commands: g (shift+)/ and m (shift+)/ (see below for rationale and user config to reproduce)

The ctrl+d/u commands use a new feature of selection-utilities version 0.6.6 that allows the page up/down to not select text during navigation. (The command differ from the default page up/down in that they are responsive to count usage)

Closes #24. No additional missing motion units (beyond comment) were found in my search.

The comment navigation was removed because it requires the user to customize selection-utilities.motionUnit for each specific language. For example, I have this in my config:

    "selection-utilities.motionUnits": [
        {
            "name": "paragraph",
            "regexs": "\\S+"
        },
        {
            "name": "section",
            "regexs": [
                ".+",
                "^.*========+.*$"
            ]
        },
        {
            "name": "comment",
            "regexs": "^\\s*//.*$"
        },
        {
            "name": "subsection",
            "regexs": [
                ".+",
                "^.*(========+|--------+).*$"
            ]
        },
        {
            "name": "pluto_cell",
            "regexs": "^# ╔═╡ "
        },
        {
            "name": "WORD",
            "regex": "[^\\s]+"
        },
        {
            "name": "word",
            "regex": "(_*[\\p{L}][_\\p{L}0-9]*)|(_+)|([0-9][0-9.]*)|((?<=[\\s\\r\\n])[^\\p{L}^\\s]+(?=[\\s\\r\\n]))"
        },
        {
            "name": "subword",
            "regex": "(_*[\\p{L}][0-9\\p{Ll}]+_*)|(_+)|(\\p{Lu}[\\p{Lu}0-9]+_*(?!\\p{Ll}))|(\\p{L})|([^\\p{L}^\\s^0-9]+)|([0-9][0-9.]*)"
        },
        {
            "name": "subident",
            "regex": "(\\p{L}[0-9\\p{Ll}]+)|([0-9][0-9.]*)"
        },
        {
            "name": "number",
            "regex": "[0-9][0-9.]*"
        },
        {
            "name": "integer",
            "regex": "[0-9]+"
        }
    ],

And then I define the bindings in masterkeys.toml as follows:

#- Comment motions

[[bind]]
path = "edit.motion.obj"
key = "g /"
priority = 1
name = "comment →"
description = "next comment"
combinedKey = "/ (shift+/)"
combinedName = "comment → (←)"
combinedDescription = "move to next (previous) comment"
args.unit = "comment"
args.boundary = "both"
computedArgs = { value = "count || 1" }

[[bind]]
path = "edit.motion.obj"
key = "g shift+/"
priority = 1
name = "comment ←"
combinedName = "comment → (←)"
description = "previous comment"
args.unit = "comment"
args.boundary = "both"
computedArgs = { value = "-(count || 1)" }

[[bind]]
path = "edit.motion.match.obj"
key = "m /"
name = "comment →"
combinedName = "comment →/←"
combinedKey = "/ (shift+/)"
args.unit = "comment"
args.boundary = "both"
computedArgs.value = "count || 1"

[[bind]]
path = "edit.motion.match.obj"
key = "m shift+/"
name = "comment ←"
combinedName = "comment →/←"
args.unit = "comment"
args.boundary = "both"
computedArgs.value = "-(count || 1)"
codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.49%. Comparing base (11175e1) to head (09b934c). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #25 +/- ## ======================================= Coverage 83.49% 83.49% ======================================= Files 24 24 Lines 2333 2333 Branches 470 470 ======================================= Hits 1948 1948 Misses 380 380 Partials 5 5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.