tbastos / vim-lua Goto Github PK
View Code? Open in Web Editor NEWImproved Lua 5.3 syntax and indentation support for Vim
Improved Lua 5.3 syntax and indentation support for Vim
Hi there,
I have trouble with the indenting proposed by this plugin. The code I am trying to write is the following:
describe("something", function()
it("does something", function()
end)
end)
I have a parenthesis-insertion plugin, so when write it(
I get it(|)
(with the cursor between the parenthesis). It seems that this confuses the indentation plugin.
From this position:
describe("something", function()
it("does something", function() |)
end)
When I press enter it gets missaligned - it seems it is trying to align the parents instead of the it
:
describe("something", function()
it("does something", function()
|)
end)
Also, the weirdest part is if I try to write end
on that position. Then the line gets completely missaligned (I don't even press enter).
describe("something", function()
it("does something", function()
end|)
end)
How can I solve this behavior?
I've used it without thinking for a while, but recently realized why lua looks weird: function calls don't use the colors for functions.
HiLink luaFuncCall PreProc
HiLink luaFuncId Function
luaSpecialValue
(built-in functions like ipairs
) also uses PreProc
which makes them look the same. However, for table.insert
table
is luaSpecialTable
and insert
is luaFuncCall
instead of luaSpecialValue
. If not for that inconsistency, it'd be nice for built-ins to stand out.
vim help says Function is:
function name (also: methods for classes)
I can see how that might be interpreted as "names in definitions" and not "names in uses", but using PreProc doesn't make sense to me.
Seems like ideally there's two changes to solve this:
Hey, how can i highlight the self keyword? thanks
Hello, I have noticed an issue with the indentation of table literals as function arguments, when the braces and parentheses are combined like below.
Expected Indentation
do
foo()
somefunction(arg1, arg2, {
key1 = val1, key2 = val2,
})
otherfunction({
key3 = val3, key4 = val4,
})
bar()
end
Actual Indentation
do
foo()
somefunction(arg1, arg2, {
key1 = val1, key2 = val2,
})
otherfunction({
key3 = val3, key4 = val4,
})
bar()
end
I ran across this repository and thought "oh cool, better Lua syntax highlighting!". I installed it and nothing happened. Then I started checking the comparison in the readme and realized I already have the improvements there. Was this merged into vim
and/or neovim
upstream? (I'm running Neovim.)
If so its probably worth mentioning that in the README.
tpope/vim-endwise lets you complete Lua code, adding an automatic end
. This is done via the following code:
let b:endwise_addition = 'end'
let b:endwise_words = 'function,do,then'
let b:endwise_pattern = '^\s*\zs\%(\%(local\s\+\)\=function\)\>\%(.*\<end\>\)\@!\|\<\%(then\|do\)\ze\s*$'
let b:endwise_syngroups = 'luaFunction,luaStatement,luaCond'
The function
completion does not work if this plugin is active. I'm not sure how to patch this.
I believe it's related to the syntax group luaFunction
.
cf. #14
How does this stack up against BetterLua.vim
For starters I'm guessing:
Anything else noteworthy? What reasons would there be to switch or not switch?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.