These days it seems like everyone is using VSCode as their main editor, and with good reasons. VScode offers a lot of cool features, and if you’re using TypeScript, you get great support out of the box. But, I’m a vim person, and more specifically, I use Neovim. Since, I write mostly TypeScript, I needed something that offered all the feature of VSCode, but for Noevim. So I created nvim-typescript.
Having used vim for quite some time, I was wanting to write a plugin to learn some more about the editor. But after looking into Vimscript, I really didn’t quite get it. Instead, I went down the path using Neovim’s remote plugin API.
The remote plugin API allows you to author a Neovim plugin in various languages (Python, Rust, Go for example) and have that communicate back to the main editor through an RPC channel. This makes it possible to write 90% of a plugin without having to touch Vimscript.
For python folks, this should feel really familiar, and for vim folks, this should feel pretty familiar as well.
After playing with the API for a bit, I authored the first version of nvim-typescript. The plugin worked really well, even if it was very minimal at first. Thankfully, there was some interest in the plugin and some contributors came to add new features and improve the code base. Thanks to all those who contributed! The code base is as much yours as it is mine.
After few new release of TypeScript, it was becoming clear that python had some limitations.
After all this, I found the time to rewrite the entire python code base, this time in TypeScript, using the node-client API. It’s a bit funny…I used a TypeScript project to test and author a TypeScript plugin. Fun times!
Now that you know some of the back story, let’s actually look at the plugin and it’s features.
First, you’ll want to install the plugin. You can use any plugin manager you’d like, but I tend to prefer dein.vim by Shougo.
You also need a global install of the neovim client.
Optionally you could install Deoplete.nvim and Denite for asynchronous completion and search interfaces.
Printed out to the console.
The plugin has a bunch of commands, all documented in the main help file. The commands focus around the idea of TS<Action>.
Or, if I wanted to edit the project tsconfig file, I could run TSEditConfig. After saving the file, the project and server instance would reload to read the updated settings.
Now this last piece is more fun than functional I think…but you can also search your entire project for a specific symbol. This does require Denite, but I think it’s worth it.
There’s also the ability to rename symbols, fix code imports, look up documentation, and get code completion.
Please, feel free to try the plugin out. If you’ve wanted to use Neovim, but also wanted some great TypeScript features, try nvim-typescript out. And if you do already use the plugin, thanks! Let me know what features you would like to see added!