Giter Club home page Giter Club logo

Comments (3)

idbrii avatar idbrii commented on July 24, 2024

It's also relevant to look at other language's syntax setup since multilingual vim users will benefit from having consistent highlighting behaviour between languages (their syntax files using vim's group names to mean the same thing).

In a survey of vim-polyglot's syntax plugins (where lua is provided by this repo), languages that define some function Call use a wide mix, but only typescript also uses PreProc:

elixir.vim|     hi def link elixirCallbackDefine Define
javascript.vim| hi def link jsFuncCall           Function
rust.vim|       hi def link rustFuncCall         Function
python.vim|     hi def link pythonFunctionCall   Function
erlang.vim|     hi def link erlangGlobalFuncCall Function
erlang.vim|     hi def link erlangLocalFuncCall  Normal
erlang.vim|     hi def link erlangLocalFuncCall  Normal
erlang.vim|     hi def link erlangGlobalFuncCall Normal
lua.vim|        hi def link luaFuncCall          PreProc
common.vim|     hi def link typescriptCall       PreProc
vlang.vim|      hi def link vFunctionCall        Special
omake.vim|      hi def link omakeCallExpr        Statement
go.vim|         hi def link goFunctionCall       Type

from vim-lua.

bfrg avatar bfrg commented on July 24, 2024

I've also found it confusing because it's inconsistent with every other syntax file I've used so far.

FWIW, I have the following in my ~/.vim/after/syntax/lua.vim:

hi link luaFuncKeyword  Statement
hi link luaLocal        Statement
hi link luaBuiltIn      Statement
hi link luaFuncCall     Function
hi link luaSpecialValue Function
hi link luaFuncTable    Identifier

This gives me a much cleaner syntax highlighting.

EDIT
In Vim >= 8.2.1703 the above links will be cleared after running :color {name} since Vim restores the hi-default links after changing the colorscheme. The hi-default links are usually set in $VIMRUNTIME/syntax/<filetype>.vim. We can override them by adding a !:

hi! def link luaFuncKeyword  Statement
hi! def link luaLocal        Statement
hi! def link luaBuiltIn      Statement
hi! def link luaFuncCall     Function
hi! def link luaSpecialValue Function
hi! def link luaFuncTable    Identifier

from vim-lua.

Iron-E avatar Iron-E commented on July 24, 2024

@idbrii half of my colorscheme is finding and fixing those, so that all the colors I choose show up where users expect 😅

Imho going by :h group-name is generally the best thing to do. Function is more specific than Type (Go), Define is for macros (Elixir), PreProc is for pre-processor commands e.g. #[derive(…)] in Rust (Typescript), Special is for tokens not bolonging to other groups (V), and Statement is for statements (which a function call may be or be a part of).


@bfrg if you're interested, here is my list of overrides for this plugin. I go back and forth as to what luaLocal should be, sometimes I think it is more like var from C# and other times I think of it like a Keyword.

from vim-lua.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.