Last Updated on March 26, 2023 by mishou
I. What do I want to do?
I wanted to convert ‘aaa aaa aaa’ to [‘aaa’, ‘aaa’, ‘aaa’] on Neovim. I was thinking of using macros but ChatGPT showed another way of using the following command.
:%s/ /', '/g | %s/^/[/g | %s/$/]/g
As always, ChatGPT has done much more than I expected.

I run the command and here is the result:

II. Using Python
I know the code for the above conversion but I asked ChatGPT and got the right code:

I have run the Pythn code with SnipRun on Neovim:
