feat: goto_bracket goes to the pair bracket under cursor

Uses simple matching nesting, as a complement to tree-sitter approach.

Flow mode shorcut ctrl+shit+\ ala Code
This commit is contained in:
Igor Támara 2025-11-09 13:27:36 -05:00 committed by CJ van den Berg
parent 57547b80ff
commit 56ea0138a5
3 changed files with 78 additions and 0 deletions

View file

@ -50,6 +50,15 @@ pub const char_pairs = [_]struct { []const u8, []const u8 }{
.{ "«", "»" },
};
pub const open_close_pairs = [_]struct { []const u8, []const u8 }{
.{ "(", ")" },
.{ "[", "]" },
.{ "{", "}" },
.{ "", "" },
.{ "", "" },
.{ "«", "»" },
};
fn raw_byte_to_utf8(cp: u8, buf: []u8) ![]const u8 {
var utf16le: [1]u16 = undefined;
const utf16le_as_bytes = std.mem.sliceAsBytes(utf16le[0..]);