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

Added option node_context

Open mkonig opened this issue 4 years ago • 5 comments

Adding an option that adds context by nodes in addition to context by lines. Example:

def myfunc():
  if var = number:
    if other = that:    
      print("yes")   <- Cursor is here

If node_context = 1, then both if would be highlighted. If node_context = 0, then only the inner if would be highlighted. if node_context = 2, then the whole function woudl be highlighted.

mkonig avatar Jan 17 '22 16:01 mkonig

For c/CPP have no effect

denstiny avatar Feb 16 '22 08:02 denstiny

Hi

I had to tsplayground to find how the elements for a language are named. For example for cpp ts uses function_definition. If you use expand, then you can define whice elements of a language should be used to expand.

This is my current setup. It does not include cpp.

require'twilight'.setup{ dimming = { alpha = 0.1, }, expand = { "function", -- "if_expression", -- python/pyright "while_statement", "if_statement", "for_statement", "function_definition", "class_definition", -- yml "document", -- lua "function_declaration", "while_statement", "if_statement", }, exclude = { "zsh", "markdown", "help", "asciidoc", "conf", "sh", "vim" }, context = 0, node_context = 2, treesitter = true, }

mkonig avatar Feb 17 '22 18:02 mkonig

你好

我必须到 tsplayground 才能找到一种语言的元素是如何命名的。 例如对于 cpp ts 使用 function_definition。 如果您使用扩展,那么您可以定义一种语言的哪些元素应该用于扩展。

这是我目前的设置。 它不包括 cpp。

需要'暮光'.setup{ 调光 = { 阿尔法 = 0.1, }, 展开 = { “功能”, -- "if_expression", --python/pyright "while_statement", "if_statement", "for_statement", "函数定义", “类定义”, - yml “文档”, - 拿 "function_declaration", "while_statement", "if_statement", }, exclude = { "zsh", "markdown", "help", "asciidoc", "conf", "sh", "vim" }, context = 0, node_context = 2, treesitter = true, }

I think I succeeded.

denstiny avatar Feb 21 '22 01:02 denstiny