dance icon indicating copy to clipboard operation
dance copied to clipboard

m doen't include <> type of brackets

Open jbytes1027 opened this issue 2 years ago • 2 comments

in kakoune the angle brackets <> can be selected with the m key

jbytes1027 avatar Aug 21 '21 20:08 jbytes1027

I'm not sure what's best here. On one hand <> is indeed useful when selecting generics in C-like languages, but on the other hand it very often conflicts with comparison and bitwise operators. I remember being bothered more often than not because a comparison had matched instead of a bracket when using m, which is why the default doesn't match <>.

I believe it would be fair to discuss the defaults here, if you think my reasoning is wrong. In the meantime, you can override this behavior by changing the keybindings as such:

{
  "key": "m",
  "command": "dance.seek.enclosing",
  "args": {
    "pairs": [
      "<", ">",
      "\\{", "\\}",
      // ...
    ],
  },
  "when": "editorTextFocus && dance.mode == 'normal'",
},
// ...

Also, ideally we would determine these pairs based on the current language, but AFAIK this information isn't made available to extensions. Better yet, using Tree sitter for syntax-based matching would be best (and is planned), but right now that's not possible.

71 avatar Aug 21 '21 21:08 71

I think context based matching would be confusing and overcomplicated, which is not the kakoune philosophy, but what I am realizing is that this project as a whole conflicts with the kakoune philosophy of simplicity. Similarly, I think brackets are brackets and dance shouldn't be tailored to be more or less convenient for a specific type of syntax like bitwise operators and comparisons.

jbytes1027 avatar Aug 22 '21 01:08 jbytes1027