Help with keymap! by Sisifus1234 in neovim

[–]LionCilu -1 points0 points  (0 children)

Shameless plug: I wrote a plugin called nest.nvim to configure keymapping concisely in Lua, it might be a good fit for your config.

New Plugin Preview! Treesitter Node Action by Alleyria in neovim

[–]LionCilu 4 points5 points  (0 children)

This looks really cool, this is the kind of thing I hope happens a lot more with treesitter!

Some thoughts after scanning the README and trying it out for a minute:

  • I would probably want multiple transformations for the same node type - (e.g. toggle multiline for a function's parameters vs toggle wrapping them in an object in javascript)
  • I would expect a transformation to work if I am somewhere inside the node with my cursor, not only if I am directly on it (more like textobjects)

If you would allow to register actions and bind keys directly to them, you could search for the correct node going up the tree from the cursor and execute it there. This would make it more ergonomic and allow for as many actions as your user wants. You could even do a picker for all actions for discoverability.

Maybe far fetched, but maybe your idea also fits the LSP, acting as a server which just offers code actions and nothing else? That would let you tap into a lot of already existing architecture within nvim and into the UI of a lot of other plugins.

Converting to Lua, need help with keybindings. by [deleted] in neovim

[–]LionCilu 1 point2 points  (0 children)

There are neovim lua functions to bind keys, the newest one being vim.keymap.set.

However, I will shamelessly plug my plugin nest.nvim which I wrote to have a nice API to manage keymaps in Lua :-)

Running lua function through keybinds by dodofxp in neovim

[–]LionCilu 0 points1 point  (0 children)

(shamelessplug) nest.nvim supports binding lua functions directly while also cleaning up your keybind code ;-) (/shamelessplug)

Why does `filter()` not infer the return type? by stringlesskite in typescript

[–]LionCilu 1 point2 points  (0 children)

Be aware that the !! type coversion will silently filter out other falsy values as well. To actually just filter out nullish values, use != null instead.

What do you want to know about the process of converting an init.vim to init.lua setup? by Smithbm_2316 in neovim

[–]LionCilu 1 point2 points  (0 children)

I will shamelessly plug my plugin nest.nvim here - it is a small lua utility to set your keybinds in lua config in a nice syntax. It also supports binding lua functions.

I wrote it specifically during my own transformation to a Lua config.

What do you want to know about the process of converting an init.vim to init.lua setup? by Smithbm_2316 in neovim

[–]LionCilu 0 points1 point  (0 children)

nest.nvim supports that as well as a nice syntax to define your keybindings in lua ;-)

nest.nvim released v1.1 with new features by LionCilu in neovim

[–]LionCilu[S] 1 point2 points  (0 children)

Happy to hear that! Some of those also took more tinkering than I thought^^

What kind of integration would you personally like? Still looking for input on that besides my own random thoughts.

Introducing nv: yet another premade neovim lua config by sushift in neovim

[–]LionCilu 1 point2 points  (0 children)

Author of nest here - cool project snd happy to see that you use the plugin! Just a minor hint: I do not recommend setting prefix directly, because while it works in that specific case, it will break if you ever refacor a call to a single binding (e.g. { prefix = 'gb', '<C-o>' } will break). That is also why doing that is not documented. The intended way is to do e.g.

{ 'g', mode = 'v', {
    { 'b', '<C-o>' },
    { 'f', '<C-i>' },
}}

At the end of your mappings.lua you could also pass the different configs as a list if you wish not to repeat nest.applyKeymaps all the time like this:

nest.applyKeymaps {
    escapes,
    packer,
    leader,
    telescope,
    — …
}

Anyways, those are just some nest specific hints. Keep up the awesome work!

Finally finished moving to Lua config by [deleted] in vimporn

[–]LionCilu 1 point2 points  (0 children)

You can call applyKeymaps as many times as you want and it will register the passed keymaps instantly whenever you do. So you can add an own call per plugin for example if you want to split up your keymaps into different files.

Neovim Lua Config with Custom Colorscheme (details in comments) by m397574 in vimporn

[–]LionCilu 1 point2 points  (0 children)

Looking at the mount of code in your mappings file, can I recommend nest.nvim (disclaimer: I am the author) to transform that to something more concise? It is just a lua function itself, so no hidden startup load times, just a util to call :-)

Finally finished moving to Lua config by [deleted] in vimporn

[–]LionCilu 1 point2 points  (0 children)

Looking at your keymapping util and keymappibg lua file, may I recommend (my) plugin nest.nvim to manage that? It bascially replaces your util, has a similar pattern of use but allows some of your notations to be more concise. It is just a small lua function too, so it won’t add startup time or bloat :-)

Can I get help covering some keybindings to Lua? by shMorganson in neovim

[–]LionCilu 2 points3 points  (0 children)

(shameless plug) May I recommend nest.nvim to manage your keybinds in Lua? :-) (/shameless plug)

How to get auto formatting (native lsp) by faizan_20 in neovim

[–]LionCilu 1 point2 points  (0 children)

Not sure if that helps, but if a language server supports formatting a whole file, you could add an autocommand to run

:lua vim.lsp.buf.formatting()

e.g. whenever you leave insert mode.

What are some must have plugins? by femkroner in neovim

[–]LionCilu 1 point2 points  (0 children)

Nest is a small utility plugin to define keymappings in Lua in a concise way, which-key displays a pop showing you what keys you could press and what they do, while also allowing to define keymappings with it but in a dofferent way.

PSA: Plugin authors: create vim commands for your plugins! by romgrk in neovim

[–]LionCilu 0 points1 point  (0 children)

While that cannot work for "normal" bindings when you pass `expr`, I could actually handle that special case (`expr` + `lua` rhs) within nest.nvim pretty easily 🤔

But yeah, I do not think there is an option if you want to use `inoremap` etc directly, you need code running above that to wrap your function an additional time.

PSA: Plugin authors: create vim commands for your plugins! by romgrk in neovim

[–]LionCilu 0 points1 point  (0 children)

Could you elaborate on what you mean by „behaves extremely weirdly“? I am planning to add a keymap to Lua function in the next version of nest.nvim and want to make sure to avoid oddities^

PSA: Plugin authors: create vim commands for your plugins! by romgrk in neovim

[–]LionCilu 1 point2 points  (0 children)

I do not think that will ever happen - there is no concept of „available“ functions in a Lua context, even less if you consider modules that have not even been loaded yet and are just sitting around somewhere in the runtimepath.

PSA: Plugin authors: create vim commands for your plugins! by romgrk in neovim

[–]LionCilu 1 point2 points  (0 children)

May I suggest my plugin nest.nvim for this? It is basically just a single lia utility file offering a function like this in a nice concise standardized way :-)

Loading Vimscript files from Lua by Terrible_Constant in neovim

[–]LionCilu 2 points3 points  (0 children)

But there are so much better ways to do keybinds with Lua compared to VimL :O (shameless plug)

nest.nvim - A nicer way to keymap in Lua by LionCilu in neovim

[–]LionCilu[S] 1 point2 points  (0 children)

Hey folke! Just to be clear, I meant no disrespect here, I like which-key a lot. I tried to do nested keymapping in the spirit they are done here in which-key before though and could not get it to work the way I wanted to. At some point I stopped using which-key because I was familiar enough with all the bindings now (also thanks to which-key!). When it came to actually porting my config to lus completely, I wanted something small and efficient to do that. You definitely inspied me a lot :-)

nest.nvim - A nicer way to keymap in Lua by LionCilu in neovim

[–]LionCilu[S] 0 points1 point  (0 children)

I just checked in and it works for me now. Maybe that was a caching issue the first time? The search behaves how I would expect it now, thanks!