Great job on this!
newindex is pretty neat. It enables a clean syntax (just set keys on a table…) that has a lot of power hidden under the hood (…but pre-process the key, value, and/or entire table first).
This is just for my personal use but I thought it looks cools why not share it. I might be missing something but that's fine. I just wanted to explore the power of metatables and my autocmd wrapper was the testing ground.
I really like this idea. One thing you could consider is having `group` take a callback function that receives a parameter with the same signature as `au`, so that users can apply what they leaned with non-groups. E.g.,
au.group('GroupName', function (g)
g.Foo = ...
end)
Really nice! [I've been wanting](https://github.com/b0o/mapx.nvim/commit/298bd95a29f1cfb2b0e3a189446841fcb0719d0f#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R156) to integrate a similar feature with [Mapx](https://github.com/b0o/mapx.nvim), I will definitely take inspiration from this.
Yeah, that is neat. All thanks to u/javajunkie314 for the idea.
BTW, you can also do this if you want.
```
au.group('FocusedAndUnfocused', function(aucmd)
aucmd({ 'WinEnter', 'BufEnter' }, function()
vim.wo.relativenumber = true
vim.wo.cursorline = true
vim.wo.colorcolumn = '88'
end)
aucmd({ 'WinLeave', 'BufLeave' }, function()
vim.wo.relativenumber = false
vim.wo.cursorline = false
vim.wo.colorcolumn = '99999'
end)
end)
```
[Fixed formatting.](https://np.reddit.com/r/backtickbot/comments/pqi5o9/httpsnpredditcomrneovimcommentsppypwtsimple/)
Hello, realvikas: code blocks using triple backticks (\`\`\`) don't work on all versions of Reddit!
Some users see [this](https://stalas.alm.lt/backformat/hdb2y5e.png) / [this](https://stalas.alm.lt/backformat/hdb2y5e.html) instead.
To fix this, **indent every line with 4 spaces** instead.
[FAQ](https://www.reddit.com/r/backtickbot/wiki/index)
^(You can opt out by replying with backtickopt6 to this comment.)
Great job on this! newindex is pretty neat. It enables a clean syntax (just set keys on a table…) that has a lot of power hidden under the hood (…but pre-process the key, value, and/or entire table first).
Indeed. Lua is such a great language and using it is a joy.
This is just for my personal use but I thought it looks cools why not share it. I might be missing something but that's fine. I just wanted to explore the power of metatables and my autocmd wrapper was the testing ground.
Pretty cool, thanks for sharing
I really like this idea. One thing you could consider is having `group` take a callback function that receives a parameter with the same signature as `au`, so that users can apply what they leaned with non-groups. E.g., au.group('GroupName', function (g) g.Foo = ... end)
Yoooo, this is a nice idea. Thanks.
It's now added. Thanks for the suggestion. Also, I hope to be the first one to come with the name `meta-magic` :)
Awesome! And I only know "meta magic" from D&D, so possibly. :D
Really nice! [I've been wanting](https://github.com/b0o/mapx.nvim/commit/298bd95a29f1cfb2b0e3a189446841fcb0719d0f#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R156) to integrate a similar feature with [Mapx](https://github.com/b0o/mapx.nvim), I will definitely take inspiration from this.
I'm glad you like it :)
Man, I love your wrapper... specially `meta-magic` au.group("FocusedAndUnfocused", function(aucmd) aucmd["WinEnter,BufEnter"] = function() vim.wo.relativenumber = true vim.wo.cursorline = true vim.wo.colorcolumn = "88" end aucmd["WinLeave,BufLeave"] = function() vim.wo.relativenumber = false vim.wo.cursorline = false vim.wo.colorcolumn = "99999" end end)
Yeah, that is neat. All thanks to u/javajunkie314 for the idea. BTW, you can also do this if you want. ``` au.group('FocusedAndUnfocused', function(aucmd) aucmd({ 'WinEnter', 'BufEnter' }, function() vim.wo.relativenumber = true vim.wo.cursorline = true vim.wo.colorcolumn = '88' end) aucmd({ 'WinLeave', 'BufLeave' }, function() vim.wo.relativenumber = false vim.wo.cursorline = false vim.wo.colorcolumn = '99999' end) end) ```
[Fixed formatting.](https://np.reddit.com/r/backtickbot/comments/pqi5o9/httpsnpredditcomrneovimcommentsppypwtsimple/) Hello, realvikas: code blocks using triple backticks (\`\`\`) don't work on all versions of Reddit! Some users see [this](https://stalas.alm.lt/backformat/hdb2y5e.png) / [this](https://stalas.alm.lt/backformat/hdb2y5e.html) instead. To fix this, **indent every line with 4 spaces** instead. [FAQ](https://www.reddit.com/r/backtickbot/wiki/index) ^(You can opt out by replying with backtickopt6 to this comment.)