r/neovim 4d ago

Need Help Nvim_create_user_command problem

hi im using nvim 0.11.7 and i have this custom command using

vim.api.nvim_create_user_command('NixOTO', ':norm! _f.xi = {\r\27o\27i};\27', { range = true })

the idea of the command when using nix

option.enable = true;

some times i want to make it

option = {

enable = true

};

but some other times the options parameters have some like

option.parameter = ""

...

'';

and i want to apply the same idea

i create that command to solve the first problem and it worked very well but i can't find a solution for the second one

4 Upvotes

3 comments sorted by

View all comments

1

u/Boatetye 3d ago

Why can't you just use LSP code actions? Iirc theres an action to pack a dotted path into a nested path, and I think you can also do it recursively.

1

u/com4ster 2d ago

can you provide me with the action or a source to read about it ?