How can I configure {d,v,c}af to target preceding comments and whitespace? #452
Unanswered
ColinKennedy
asked this question in
Q&A
Replies: 1 comment 1 reply
-
White spaces can be handled by this option. nvim-treesitter-textobjects/README.md Line 79 in 35a60f0 A problem with tree-sitter queries is that they always just can select single nodes. We found a work-around with nvim-treesitter-textobjects/queries/cpp/textobjects.scm Lines 12 to 13 in 35a60f0 #make-range! predicate that will likely be removed in the refactoring nvim-treesitter and maybe replaced by something else.
To select all nodes of |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use nvim-treesitter-context for Python and C++ development. While it is useful, one property of other plug-ins which aim to do the same thing that I miss very much is for motions such as
daf
to effectively mean "Once executed, your cursor is just oneo
away from making a new function as if the previous function never existed". It's easier to explain visually.|X|
is the current cursor positionWhen I press
daf
, I want this outputNow if I press
o
, the cursor is exactly where it should be define a new function.And the pre / post whitespace around the methods have been preserved (2 lines above, 3 lines below)
Instead though, I get this
I tried modifying queries/python/textobjects.scm to capture preceding comments as well like this
And a few similar variations but none of them work. Any advice on what query to use would be appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions