public void Simple() { VimData.AddAutoCommand(EventKind.FileType, "html", "set ts=14"); var vimBuffer = CreateVimBufferWithName("foo.html"); Assert.Equal(14, vimBuffer.LocalSettings.TabStop); }
public void NoEventsOnDisable() { VimData.AddAutoCommand(EventKind.BufEnter, "*.html", "set ts=12"); VimHost.IsAutoCommandEnabled = false; var vimBuffer = CreateVimBufferWithName("foo.html"); Assert.Equal(8, vimBuffer.LocalSettings.TabStop); }
public void SimpleWithAltPattern() { VimData.AddAutoCommand(EventKind.FileType, "*xml", "set ts=12"); var vimBuffer = CreateVimBufferWithName("foo.xml"); _autoCommandRunner.RunAutoCommands(vimBuffer, EventKind.FileType); Assert.Equal(12, vimBuffer.LocalSettings.TabStop); }
public void IgnoreWhenDisabled() { Vim.GlobalSettings.AutoCommand = false; VimData.AddAutoCommand(EventKind.FileType, "xml", "set ts=12"); var vimBuffer = CreateVimBufferWithName("foo.xml"); _autoCommandRunner.RunAutoCommands(vimBuffer, EventKind.FileType); Assert.Equal(8, vimBuffer.LocalSettings.TabStop); }
public void NoEventsOnDisableClose() { _globalSettings.AutoCommand = false; VimData.AddAutoCommand(EventKind.BufWinLeave, "*.html", "set ts=12"); var vimBuffer = CreateVimBufferWithName("foo.html"); vimBuffer.Close(); Assert.Equal(8, vimBuffer.LocalSettings.TabStop); }
public void DisableChange() { VimHost.IsAutoCommandEnabled = false; VimData.AddAutoCommand(EventKind.BufWinLeave, "*.html", "set ts=12"); var vimBuffer = CreateVimBufferWithName("foo.html"); VimHost.IsAutoCommandEnabled = true; vimBuffer.Close(); Assert.Equal(12, vimBuffer.LocalSettings.TabStop); }
public void StopInsert() { var autoCommandRunner = new AutoCommandRunner(Vim); VimData.AddAutoCommand(EventKind.BufEnter, "*", "stopinsert"); var vimBuffer1 = CreateVimBuffer("abc", "def", ""); var vimBuffer2 = CreateVimBuffer("ghi", "jkl", ""); Assert.Equal(ModeKind.Normal, vimBuffer2.ModeKind); vimBuffer2.SwitchMode(ModeKind.Insert, ModeArgument.None); Assert.Equal(ModeKind.Insert, vimBuffer2.ModeKind); autoCommandRunner.RunAutoCommands(vimBuffer1, EventKind.BufEnter); Assert.Equal(ModeKind.Insert, vimBuffer2.ModeKind); autoCommandRunner.RunAutoCommands(vimBuffer2, EventKind.BufEnter); Assert.Equal(ModeKind.Normal, vimBuffer2.ModeKind); }