twilight.nvim icon indicating copy to clipboard operation
twilight.nvim copied to clipboard

[Feature Request] Always highlight entire function when within the function

Open WizardOfFaraz opened this issue 3 years ago • 4 comments

Great plugin!

Is there a way to always keep the entire function highlighted when within the function?

If yes, is there a way to easily toggle that option without changing my init file and restarting?

WizardOfFaraz avatar Jul 11 '22 18:07 WizardOfFaraz

I think this is a duplicate of #14 . There's some discussion there how to find the name of the treesitter node to include in the expand table using treesitter playground. TL;DR: what you want is most likely to add "method_definition" in the expand table.

okuuva avatar Sep 22 '22 07:09 okuuva

Adding "function_definition" to the expand section works as expected for Python methods.

jluzny avatar Aug 15 '23 05:08 jluzny

For those coming here trying to make it work with Rust functions, you are looking for 'function_item' in the expand section..... You're most welcome ;)

cmaughan avatar Jan 26 '24 12:01 cmaughan

For those who interested for same functionality in Golang just add following lines to expand section in your config:

function_declaration method_declaration

You can also find this out for other languages here. Just change go keyword in url to your language and you ready to go!

image

andrew528i avatar Mar 13 '24 21:03 andrew528i