-
Notifications
You must be signed in to change notification settings - Fork 756
Description
Feature
There are several issues about commands not being sensitive comments and strings:
I think in the end it's about:
m- text objects
show-matchinghighlighter
While I know that it is a design decision that Kakoune does not "know" about syntax of programming languages, I think it should provide tools so that such basic commands like "jump to the matching paren" or "select the balanced expression" can be defined. Especially editing Lisp in Kakoune is not great, since everything is based on balanced expressions. There is no simple way with Kakoune's commands to write an indent-on-new-line hook that does not break when there are parentheses as escaped characters, inside comments or inside strings.
In order to define the text object commands and the matching pairs commands so that they respect comments, strings and escaped characters, you basically have to run another program that parses the whole buffer whenever it is changed. I think this shouldn't be the case that you need something like tree-sitter to do basic editing.
So the idea would be to add options excluded_regions and excluded_regex where we can define what should be excluded from the m command, show-matching highlighter and text objects. That way it's simple to unset this option to get the usual behaviour.
declare-option regex scheme_excluded_regex "#\\(\(|\)|\[|\]|\{|\})"
set window excluded_regex %opt{scheme_excluded_regex}
set window excluded_regions \
shared/scheme/string \
shared/scheme/comment \
shared/scheme/comment-form \
shared/scheme/comment-block
But when we are talking about regions maybe it would be better to abstract them from the highlighters first. #2582
Are there other ways to deal with balanced expressions and make the m command and text objects more useful?
Usecase
No response