Skip to content

Commit

Permalink
Add g:gui_dotnvim when starting neovim
Browse files Browse the repository at this point in the history
  • Loading branch information
dontpanic92 committed May 19, 2019
1 parent a822de3 commit 96fba48
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 22 deletions.
8 changes: 4 additions & 4 deletions Dotnvim.NativeInterop/Dotnvim.NativeInterop.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
5 changes: 5 additions & 0 deletions Dotnvim/Controls/ControlBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public ControlBase(IElement parent)
/// <inheritdoc />
public override void Draw(D2D.DeviceContext deviceContext)
{
if (this.Size.Width == 0 || this.Size.Height == 0)
{
return;
}

if (this.backBitmap == null || this.backBitmap.Size != this.Size)
{
this.InitializeBackBuffer(deviceContext, this.Size);
Expand Down
4 changes: 2 additions & 2 deletions Dotnvim/Dotnvim.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@
</Page>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.0-beta008\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.0-beta008\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.118\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.118\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
8 changes: 0 additions & 8 deletions Dotnvim/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,16 @@
namespace Dotnvim
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Dotnvim.Controls;
using Dotnvim.Events;
using Dotnvim.NeovimClient.Events;
using Dotnvim.Utilities;
using SharpDX;
using SharpDX.Direct2D1;
using SharpDX.Mathematics.Interop;
using static Dotnvim.NeovimClient.NeovimClient;
using D3D11 = SharpDX.Direct3D11;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Dotnvim/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<package id="SharpDX.Direct3D11" version="4.2.0" targetFramework="net461" />
<package id="SharpDX.DirectComposition" version="4.2.0" targetFramework="net461" />
<package id="SharpDX.DXGI" version="4.2.0" targetFramework="net461" />
<package id="StyleCop.Analyzers" version="1.1.0-beta008" targetFramework="net461" developmentDependency="true" />
<package id="StyleCop.Analyzers" version="1.1.118" targetFramework="net461" developmentDependency="true" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
</packages>
10 changes: 10 additions & 0 deletions NeovimClient/API/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,15 @@ public void WriteErrorMessage(string message)
{
this.msgPackRpc.SendRequest("nvim_err_writeln", new List<object>() { message });
}

/// <summary>
/// Set a global (g:) variable.
/// </summary>
/// <param name="name">Variable name.</param>
/// <param name="value">Variable value.</param>
public void SetGlobalVariable(string name, string value)
{
this.msgPackRpc.SendRequest("nvim_set_var", new List<object>() { name, value });
}
}
}
10 changes: 10 additions & 0 deletions NeovimClient/NeovimClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ public void Input(string text)
this.neovim.Global.Input(text);
}

/// <summary>
/// Set a global (g:) variable.
/// </summary>
/// <param name="name">Variable name.</param>
/// <param name="value">Variable value.</param>
public void SetVariable(string name, string value)
{
this.neovim.Global.SetGlobalVariable(name, value);
}

/// <summary>
/// Write an error message to the vim error buffer.
/// </summary>
Expand Down
7 changes: 3 additions & 4 deletions NeovimClient/NeovimClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="MsgPack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a2625990d5dc0167, processorArchitecture=MSIL">
<HintPath>..\packages\MsgPack.Cli.1.0.0\lib\net46\MsgPack.dll</HintPath>
<HintPath>..\packages\MsgPack.Cli.1.0.1\lib\net46\MsgPack.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -132,9 +132,8 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.0-beta008\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.0-beta008\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.118\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.118\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion NeovimClient/NeovimRpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public NeovimRpcClient(string path, IRedrawEventFactory<TRedrawEvent> factory)
RedirectStandardInput = true,
RedirectStandardOutput = true,
WorkingDirectory = Path.GetDirectoryName(path),
Arguments = "--headless --embed",
Arguments = @"--headless --embed --cmd ""let g:gui_dotnvim = 1""",
},

EnableRaisingEvents = true,
Expand Down
4 changes: 2 additions & 2 deletions NeovimClient/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MsgPack.Cli" version="1.0.0" targetFramework="net461" />
<package id="StyleCop.Analyzers" version="1.1.0-beta008" targetFramework="net461" developmentDependency="true" />
<package id="MsgPack.Cli" version="1.0.1" targetFramework="net461" />
<package id="StyleCop.Analyzers" version="1.1.118" targetFramework="net461" developmentDependency="true" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
</packages>

0 comments on commit 96fba48

Please sign in to comment.