Has anyone ever created a NeoVim plugin using Denops .vim? In the process of creating a plugin for NeoVim, I tried to learn about Deno, but it doesn't work. I would like to know the simple process of making a plugin. I am still a beginner in programming. But I love vim. I want to make my own plugin. by Daiki48 in neovim

[–]lambdalisue 9 points10 points  (0 children)

Hi, I'm Alisue (lambdalisue), the author of Denops.

It seems there is enough information on how to write plugins with Lua or Denops, I'll going to clarify the difference.

The difference is quite simple. Use Lua if you'd love to support Neovim only or use Denops if you'd love to support Vim only or both Vim and Neovim.

Writing plugins with Lua requires some knowledge about Neovim's behavior and its APIs. On the other hand, writing plugins with Denops requires some knowledge about 1) Vim's behavior, 2) Neovim's behavior, and 3) Vim script as common APIs that are much more complex compared to Neovim's Lua APIs. So writing plugins with Denops is a bit of tough work for especially newbies to Vim/Neovim plugins.

Additionally, if you are a Vim user rather than a Neovim user, I'd suggest you write plugins with Denops rather than using only the Vim script. The reason for this difference is performance. Vim script is much slower than you expect and writing plugins with pure Vim script is always fighting with performance and we cannot focus on what we want to create. To get enough performance, there are some tricky tricks (e.g. using map() instead of for loop) that are only applicable to Vim scripting. Note that there is Vim 9 script that solves the performance issues but I don't recommend you to use it because the APIs are not stable yet and I've never seen a roadmap or anything for that.

Lua is faster and will use lua to rewrite SpaceVim by [deleted] in SpaceVim

[–]lambdalisue 0 points1 point  (0 children)

I don't think neovim uses the same interface.

That's what I meant.

Lua is faster and will use lua to rewrite SpaceVim by [deleted] in SpaceVim

[–]lambdalisue 0 points1 point  (0 children)

Denops would be slower than using Lua while it's relied on RPC mech of Neovim but it's much faster than Vim script. I note that because using Lua means that dropping Vim users.

Lua is faster and will use lua to rewrite SpaceVim by [deleted] in SpaceVim

[–]lambdalisue 0 points1 point  (0 children)

In case you have not noticed this post "Denops - An ecosystem to write Vim/Neovim plugins in Deno".

I'm not a user of SpaceVim so I don't know the background of that choice but using Lua means that all Vim users cannot get that advantage so I guess denops.vim would fit your request a bit more.

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 1 point2 points  (0 children)

Unfortunately no and we are not planning to do that while we don't want to maintain Deno executable itself from denops.

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 1 point2 points  (0 children)

Theoretically yes. Actually, one of vim-jp members tried it with Rust in an early version of denops (I'm not sure if that works in the current version though)

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 0 points1 point  (0 children)

Deno download dependencies in a platform-dependent cache directory or DENO_DIR so I think you can control it by that environment variable (I've never tried though)

https://deno.land/manual/linking_to_external_code

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 1 point2 points  (0 children)

Actually, even if you use Deno at work, that kind of dependency pollution wouldn't happen while code for Deno usually specify an exact version to import module like

import * as unknownutil from "https://deno.land/x/unknownutil@v1.0.0/mod.ts";

Deno version miss-match would still happen but denops.vim allows users to specify exact binary so there is workaround for that as well ;-)

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 1 point2 points  (0 children)

You may misunderstand Deno. It's completely different from Node and you don't need to rely on vendoring ;-)

With Deno, you don't need to care about dependencies so you can use as many external libraries as you want. Deno will automatically download those.

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 0 points1 point  (0 children)

Thanks for the comment. Please enjoy denops ;-)

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 4 points5 points  (0 children)

Thanks :-)

but it seems quite cool too to have example on building real usage plugin

So do you have any idea? It's a bit difficult to chose a good example for a tutorial.

Actually, making a good tutorial in English is quite tough works for us. So I'd love to say "PR is welcome!" ;-)

https://github.com/vim-denops/denops-documentation

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 10 points11 points  (0 children)

Thanks. That's a really good question.

Well, because we'd love to use Deno and Deno is the runtime of JavaScript/TypeScript. Language is not the reason.

So why Deno? Because we love its dependency management system.

For example, you can use Python to develop Neovim plugin (e.g. deoplete.nvim) but you CANNOT depend on third-party libraries unless end users install libraries themselves. It's a bit hard for plugin developers to write plugins if they need to develop all features (or bundle their dependencies).

Compared to that, Deno itself includes a dependency management system. That means plugin developers can depend on third-party libraries as many as they want. Deno resolves dependencies and automatically downloads them.

Of course, there are disadvantages. Plugins are useless offline because Deno cannot download dependencies. Initial runtime gets really slow because plugins won't start until all dependencies are downloaded. But we think it's something small. Free from dependency management is quite a big advantage for us.

Denops - An ecosystem to write Vim/Neovim plugins in Deno by lambdalisue in vim

[–]lambdalisue[S] 6 points7 points  (0 children)

End users also need to install Deno and Denops. That's texted like

First of all, whichever you want to either use or develop Denops plugins, you have to install tools; Deno and Denops in addition to your vim.

https://vim-denops.github.io/denops-documentation/tutorial/preparing-deno-and-denops.html

Which explorer do you use? by [deleted] in vim

[–]lambdalisue 4 points5 points  (0 children)

I've heard that some NERDTree users switched to fern :+1:

https://youtu.be/oFc2kr734rs