-
-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hello!
As your parser was added to the nvim-treesitter repository I tried to test it but saw some erroneous behavior when using braces on bind-key
expressions.
Example
See the following code snippet, extracted from my dotfiles:
bind -n M-Left { select-pane -L; }
# I am a comment
It creates the following tree:
(file ; [0, 0] - [2, 0]
(ERROR ; [0, 0] - [1, 16]
(command) ; [0, 0] - [0, 4]
(command_line_option) ; [0, 5] - [0, 7]
(key) ; [0, 8] - [0, 14]
(select_pane_directive ; [0, 17] - [0, 31]
(command) ; [0, 17] - [0, 28]
(command_line_option)) ; [0, 29] - [0, 31]
(ERROR) ; [0, 31] - [0, 32]
(ERROR))) ; [1, 2] - [1, 16]
Screenshot

My theory is that the issue is with braces in general.
In the man file for tmux you can see the following example:
Braces are parsed as a configuration file (so conditions such as ‘
%if
’ are processed) and then converted into a string. They are designed to avoid the need for additional escaping when passing a group of tmux commands as an argument (for example toif-shell
). These two examples produce an identical command - note that no escaping is needed when using{}
:if-shell true { display -p 'brace-dollar-foo: }$foo' } if-shell true "display -p 'brace-dollar-foo: }\$foo'"Braces may be enclosed inside braces, for example:
bind x if-shell "true" { if-shell "true" { display "true!" } }