Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Vimscript creates a complete plug-in


May 24, 2021 Vim


Table of contents


In the first forty chapters, we explained many basic aspects. In the last part of this book, we'll try to create a Vim plug-in for a language from scratch.

This is not a game for cowards. This will require you to do your best.

If you want to quit now, it's not bad! You've learned ~/.vimrc and if you fix bugs in someone else's plug-in.

It's not shameful to have the idea that "that's enough, I don't want to throw my back on creating a plug-in that I won't use." B e realistic. If you don't want to create a plug-in you want to use, you can leave now and come back when you want.

If you really want to continue, make sure you can squeeze out some time. The rest of the book will be difficult, and I'll assume that you really want to learn something, rather than just lazily turning over a chapter.

Potion

The plug-ins we create will support the Potion language.

Potion is Why the lucky stiff language created by Why the lucky stiff before it was hidden in the river and lake. It's very simple, so we'll give it a try.

Potion is similar to Io, drawing on Ruby, Lua, and other languages. I f you haven't played Io, it may look a little odd. I highly recommend spending at least an hour or two playing Potion. You won't use it in real life, but it may change the way you think and give you new ideas.

Potion's current implementation is fairly rough. F or example, if you make a grammatical error, it usually returns your segment error. D on't get too tangled up in this. I'll give you a lot of code demonstrations available so you can focus more on Vimscript itself than on Potion.

Our goal is not to learn Potion (although that's interesting). Our goal is to use Potion as a small example to experience every aspect of writing a complete Vim plug-in.

Practice

Download and install Potion. Y ou're going to do this yourself. It should be simpler.

Make sure you can run the first sample code in the booklet as a Potion interpreter and as a .pn file. If the interpreter doesn't seem to work, look at this issue to find the possible cause.