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.

ChatGPT explains

I run the command and here is the result:

The results shown in Neovim

II. Using Python

I know the code for the above conversion but I asked ChatGPT and got the right code:

The Python code created by ChatGpt

I have run the Pythn code with SnipRun on Neovim:

The result

By mishou

Leave a Reply

Your email address will not be published. Required fields are marked *