Ⅰ. 插件描述
Nvim .NET client and plugin hostⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'neovim/nvim-net'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'neovim/nvim-net'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'neovim/nvim-net'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/neovim/nvim.net
Ⅳ. 文档说明
Nvim.NET
.NET client for Neovim
Plugin Host Install
Using vim-plug:
Plug 'neovim/nvim.net'
Quickstart for Linux
- Install dotnet
Clone the Nvim .NET client (this repo):
git clone https://github.com/neovim/nvim.netRun the tests, to check that everything is working:
dotnet test test/NvimClient.Test/NvimClient.Test.csproj
Plugin Development with C
Create a new solution and class library project.
mkdir my-plugin dotnet new sln dotnet new classlib --output my-plugin dotnet sln add my-plugin/my-plugin.csprojInstall the
NvimClient.APINuGet packagedotnet add my-plugin/my-plugin.csproj package NvimClient.APICreate a class like this
using NvimClient.API; using NvimClient.API.NvimPlugin.Attributes; using NvimClient.API.NvimPlugin.Parameters; namespace MyPlugin { // Make sure the class is public and has the NvimPlugin attribute. [NvimPlugin] public class MyPlugin { private readonly NvimAPI _nvim; // Constructor with exactly one `NvimAPI` parameter. public MyPlugin(NvimAPI nvim) { _nvim = nvim; } // Use attributes to expose functions, commands, and autocommands. // Valid parameter types and return types are: // string, bool, long, double, T[], and IDictionary<T, T> [NvimFunction] public long MyFunction(long num1, long num2) { return num1 + num2; } [NvimCommand(Range = ".", NArgs = "*")] public void MyCommand(long[] range, params object[] args) { _nvim.SetCurrentLine( $"Command with args: {args}, range: {range[0]}-{range[1]}"); } [NvimAutocmd("BufEnter", Pattern = "*.cs")] public void OnBufEnter( [NvimEval("expand('<afile>')")] string filename) { _nvim.OutWrite($"my-plugin is in '{filename}'\n"); } } }- Make the directory
rplugin/dotnetin the same directory as the solution file.
If you are using git, you will need to create a file inside the directory
so it can be tracked.
mkdir rplugin/dotnet
echo '' > rplugin/dotnet/.keep
git add rplugin/dotnet- Start
nvimand run:UpdateRemotePlugins.
Build
dotnet build
Generate API
The API generator takes two arguments: the output path of the generated C# class
file and the path to the Neovim source directory. nvim and doxygen must be
in the PATH.
dotnet run --project src/NvimClient.APIGenerator/NvimClient.APIGenerator.csproj
src/NvimClient.API/NvimAPI.generated.cs
/usr/local/src/neovim/
Test
Run all tests (nvim must be in the PATH):
dotnet test test/NvimClient.Test/NvimClient.Test.csproj
Run only the TestMessageDeserialization test:
dotnet test --filter TestMessageDeserialization test/NvimClient.Test/NvimClient.Test.csproj