ViEmu Blog

A blog about all things ViEmu
the one true editor
since 2005!

Archive for the ‘misc’ Category

ViEmu/VS 2.1.27: Several Fixes and gt/gT Implemented

Tuesday, June 24th, 2008

I’ve spent several days addressing pending support issues from the forums and customer requests, and I’ve consolidated them in this new release, together with the feature to go to next/previous tab with gt and gT. This is a vim 7 feature that works with tabs in vim, but since VS implements a model where buffers and tabs are basically the same, in ViEmu they do the same as :bn[ext] and :bp[rev].

Here is the detailed list of issues this version addresses:

You can download the installer for the new version here:

You need to manually uninstall the previous version before installing this one.

I’m planning to implement some more interesting feature and release 2.2 for both VS and SQL in the next few days. I’ll take the chance to send a mail out to all customers and subscribers after this, I haven’t done so in many months, and for example I haven’t notified customers about this blog by email at all. I guess I take my non-spammer policy too seriously some times.

Let me know about anything else that comes up, either through the comments here or on the forums.

ViEmu/VS 2.1.26 fixing a freeze (‘undo’ on an running ASP/VB app in VS2008)

Tuesday, June 10th, 2008

The title says it all. The bug was reported here: When doing ‘undo’ with ViEmu on a VB file in an ASP.NET/VB.NET web app under VS2008, Visual Studio would freeze. This was due to the ‘Edit.Undo’ calls ViEmu does failing silently, and ViEmu not realizing it. ViEmu does several calls to this VS function, in order to undo the last complete action, and it would get stuck in an infinite loop due to this reason. I’ve now made it bail out if any of the calls fails.

Here is the link to download it:

Be sure to manually uninstall the previous version from the control panel before installing this one.

I will make this the officila latest build downloaded from the main download links after it’s been out there a bit longer.

ViEmu/VS 2.1.25 fixing crash with Visual Assist

Wednesday, May 28th, 2008

I built and released ViEmu/VS 2.1.25 a few days ago:

You’ll need to manually uninstall the previous version of ViEmu before installing this one.

As described on this ViEmu forum thread, ViEmu could crash VS under certain circumstances, after pressing <Ctrl-]> to jump to the definition of the symbol under ther cursor, due to Visual Assist delaying the interception of the target file and ViEmu assuming interception would be instant (as it is when Visual Assist isn’t present).

ViEmu/VS 2.1.24 with proper wrapscan and proper ‘<,'> marks with $

Saturday, March 15th, 2008

I have just built and uploaded ViEmu for Visual Studio 2.1.24. It fixes two problems:

  • Just reported yesterday, doing Vj$:'<,’>s/xyz/uvw/g would complain about ‘mark not set’. The reason was that the ‘$’ motion tried to set the ‘> end-of-visual-region marker in a position with column = infinite (that’s why doing $ and moving up and down goes to the last column of each line), and this type of marker didn’t work well. It’s now fixed.
  • Pending from a long time ago, a ‘/’ search from the last line of a file if this was empty would not find anything even if ‘wrapscan’ is set. This was a bug in the wrapping logic of the regular expression finder. It’s been fixed too.

You can download it here:

Remember you need to manually uninstall the previous version of ViEmu before installing this one.

Let me know how it works for you.

ViEmu/VS 2.1.23 addressing incompatibility with F# language with Visual Assist

Friday, March 14th, 2008

I have just built & uploaded ViEmu/VS 2.1.23, which fixes some problems with F# language files in the presence of Visual Assist. Yes, the VS ecosystem can be quite complex at times, but I always try to address incompatibilities as soon as possible.

You can download it from here:

Be sure to manually uninstall the previous version before installing this one. I have also promoted this build to the ‘official’ build downloaded from the main download page, so you might already have it if you downloaded it from there.

ViEmu/VS 2.1.22

Sunday, February 24th, 2008

A few days ago I built & uploaded ViEmu for Visual Studio 2.1.22. The two improvements are:

  • Support for the localized Korean version of Visual Studio (automatic keybinding removal wouldn’t work)
  • A :ve[rsion] command that shows the current ViEmu version in the command line

As always, you can download it from the relevant forum thread at the top of the forums:

I’m traveling and thus out of the office all of next week, so support will probably be a bit worse/slower than usual. Hopefully, I’ll have a quite March afterwards and I’ll be able to address a lot of pending issues.

New ViEmu/VS release with improved Resharper compatibility

Sunday, January 6th, 2008

A few days ago, I received some feedback that ViEmu/VS’s compatibility mechanisms for Resharper didn’t work fine with Resharper 3.1. Off I went and investigated it. It turns out that the latest version uses different internal names for the commands ViEmu intercepts, and thus I had to update the interception code to recognize the new names. Don’t worry, this is in addition to the old names, so now ViEmu/VS is equally compatible with all of them. Here is the new build, 2.1.21:

You need to manually uninstall the previous version before installing this one.

What the compatibility code does it it detects when the Resharper ‘Rename’ command has been issued, and if this is an ‘inline’ rename instead of a dialog-based one (which, afaik, only happens with local variable renames), it auto-enters insert mode. This works nicely, except for two glitches which are pretty hard to solve:

  • If you issue the ‘Rename’ command by first using the Resharper ‘Refactor This’ command, which pops up a small command list, ViEmu can’t intercept this. It’s not a VS command, but some internal Resharper mechanism, and there is no way to intercept it that I know of (I did ask the Resharper devs about this, and I didn’t get any usable suggestion)
  • Also, when renaming inline in insert mode, Resharper is kind of ‘king’, so if you press Esc, it will cancel the rename. You need to press Enter first to accept it, and then Esc to exit insert mode. It would be good to accept it with Esc, but it’s beyond ViEmu’s reach (it’s Resharper handling the Esc keypress)

All in all, it ViEmu should work a little bit better with Resharper now. Drop me a line if there are more glitches that need some care, or if you have any suggestions to the above issues.

BTW, for those of you reading this through an RSS reader, be sure to visit the blog to enjoy the new look, as I have styled it according to the rest of the ViEmu site and integrated it properly in the navigation bar, etc… now looks so much nicer with all the pages, the forums, the blog, etc… all styled and integrated properly!

ViEmu/VS and Coderush compatibility week

Saturday, December 29th, 2007

I’ve spent the past few days tracing code in assembly like crazy to address several issues. Some of them caused by my recent acquisition of a new laptop with the flashy Vista (I will probably post about the horrible experience at, including some amazing workarounds I had to devise). But some of them were in order to solve some compatibility issues with DevExpress’s Coderush with ViEmu for Visual Studio (as reported by a user here in the ViEmu forums). The bad news is that I almost got crazy in the process. The good news is that I was able to find a work around and release a new build of ViEmu/VS (2.1.20):

It’s necessary to manually uninstall the previous version of ViEmu/VS before installing this one.

The bug was reported as Visual Studio 2008 crashing if some specific Coderush refactoring was used, a certain specific way of exiting the refactoring-mode was used, and then you used ViEmu’s ‘u’ to undo the action. It took me a couple of days just to reliaby reproduce the bug, mainly because Coderush refused to work on my new Vista laptop. I googled for solutions to the problem, and sure enough I found someone else reporting it on the Coderush forums, but the DevExpress developers had been unable to reproduce or fix it. I finally found a blog post by emad providing a solution, so I was able to install Coderush on my laptop and reproduce the problem. I tried to post the link to the Devexpress support forum, but they almost wanted me to provide my mothers maiden name to post, so I ended up not contributing the solution (hint hint).

After reproducing it, and debugging an instance of VS 2008 with a debug build of ViEmu and Coderush install, I found out that the call that ViEmu does to perform the undo (IOleUndoManager.UndoTo(pUndoTo)) triggered a crash, with the following call stack:

msenv.dll ! NEnvMsenvTextMgr::CGlobalUndoCoordinator::SavePendingTextBuffers()  + 0x384
msenv.dll ! CMultiDocUndoParent::Do()  + 0x22d
msenv.dll ! COleUndoManager::UndoTo()  + 0x7b
ViEmu.dll ! VSBufAccess::Undo()
ViEmu.dll ! ViOpControl<>::Undo()
ViEmu.dll ! nglib::ViCommandControl<>::Undo()
ViEmu.dll ! nglib::ViCommandsImpl<>::CmdUndo(nglib::ViTrackCommand<> * pTrack=0x0012d724)
ViEmu.dll ! nglib::PerformCommand<>(nglib::ViCommandControl<> & control={...}, nglib::ViCookedCommand<> Command={...}, bool doing_dot=false)
ViEmu.dll ! nglib::ViCore<ViCoreControl>::ExecCommand<>()
ViEmu.dll ! nglib::ViCore<ViCoreControl>::CoreProcessKey<>()
ViEmu.dll ! nglib::ViCore<ViCoreControl>::ProcessKey<>(nglib::key_win32w k={...}, ViOpControl<> & OpControl={...}, VSCaretOps<> & CaretOps={...})
ViEmu.dll ! TInterceptor::ProcessKey(nglib::key_win32w key={...})
ViEmu.dll ! TInterceptor::SubClassProc(HWND__ * hwnd=0x00270a36, unsigned int msg=258, unsigned int wParam=117, long lParam=1441793)
user32.dll ! _InternalCallWinProc@20()  + 0x28

What this means is that ViEmu’s call to undo was triggering some internal pending text buffer save, which was crashing. I was also able to reproduce it with VS2005, so the issue had been lurking in there for some time. I tried all sorts of workarounds to try to force a ‘flush’ of the pending state before doing my call, but in the end I found that the only way to avoid it was to do the ‘undo’s by calling DTE.ExecuteCommand(“Edit.Undo”), rather than the internal IOleUndoManager.UndoTo(). The problem is that using the DTE method doesn’t allow me to specify which or how many actions to undo, which is key to proper vim-like undo emulation (a command like “cwhello<esc>” has to undo both the typing of ‘hello’ and the deletion of the previous word). In the end, I could do a manual inspection of the stack combined with a DTE call for each undo step, which worked around the issue reliably.

This is one of those cases where I like to think that it’s not a ViEmu bug, but one which was hiding inside Visual Studio and only triggered by the pretty sophisticated use of VS that ViEmu has to do. I could have probably recreated the bug by generating a new add-in with one button and 3 lines of code that called the internal UndoTo(). I’ve done that kind of thing in the past to report issues to Microsoft. But since neither MS or DevExpress are likely to release timely fixes, I just went straight to finding a workaround.

Anyway, the new versions is up there for download to interested parties, and I’ll be testing it myself intensively to verify that the new way to do undo grouping doesn’t cause any unwanted issues, and promote this to the official 2.1 build in the near future. Meanwhile, I’ve found a few issues between VS2008, Coderush and Codekana that I need to address, and someone dropped me a line that ViEmu’s Resharper compatibility measures are not doing very well with the latest Resharper 3.0… thus is the life of a plug-in the developer.

Happy New Year everyone, and I hope 2008 will be full of success for all of you and your own projects and void of any new compatibility problems for ViEmu! 🙂

New ViEmu/SQL version fixing Vista install problems

Saturday, December 22nd, 2007

As explained yesterday, I’ve just built and uploaded ViEmu/SQL 2.1.18 making installation fail-proof for Vista. No other changes, so you don’t need to update – but hopefully the installer will get ViEmu/SQL to start working more reliably on all systems.

New version of ViEmu/Word&Outlook solving Vista install problems

Friday, December 21st, 2007

I just built & uploaded ViEmu/Word&Outlook 1.0.24, and made this the ‘official’ 1.0 release at the same time (that is, if you go to the ViEmu home page and click ‘download’, this is the build you’ll get). The ViEmu code itself is the same (with just a new 1.0.24 version tag), only the installer has changed.

The fix to the installer is to make it write ViEmu’s COM class registration info to HKEY_LOCAL_MACHINE instead of HKEY_CLASSES_ROOT. The original behavior could sometimes result into ViEmu not loading in Word & Outlook at all, when installing under Vista. It was weird, and difficult to figure out. Only after I could reproduce it in the new Vista laptop I got last week I could properly investigate it. It turns out that, under Vista, entries written to HKCR are redirected to the per-user HKEY_CURRENT_USER, unlike under XP. I believe that Word should still work fine, but it seems sometimes doesn’t. The design behind the registry, the Windows installer, the COM architecture itself, and the Word add-in model are so bad that you never know what may be happening. Anyway, this shouldn’t happen anymore with the updated installer.

I don’t know why this happens in some Vista systems and not on others (actually, it just works fine most of the time). I won’t bother to investigate the exact reason, as the new installer system makes sure that registry entries are written to the best place and the whole issue is sidestepped (and I’m not keen on investigating Vista’s quirks more than strictly necessary).

In the next few days, I will prepare an updated ViEmu/SQL installer with the same fix. ViEmu/VS is unaffected because it’s a VS ‘package’, rather than an add-in, which doesn’t use the regular COM registration mechanism.

By the way, I’ve started using Vista full time on my laptop. General impressions are good, the fact that VS.NET 2003 is not supported and freezes as soon as I do a “Find in Files” is not nice. I will move all my projects to build using VS2005 at some point in the next few weeks, but for now I’m doing pure development inside an XP VM. VS.NET 2003 has remaind nice & stable and I just prefer not to upgrade unless there is a really compelling reason.


ViEmu: vi/vim emulation for Visual Studio, Word, Outlook and SQL Server:
See where ViEmu customers are around the world:
Map of ViEmu customers around the world
Hear what others are saying about ViEmu:
ViEmu testimonials
Learn vi/vim easily with this cheat-sheet and tutorial:
Vi/vim Cheat Sheet and Tutorial
Read why vi/vim editing is the killerest:
Why vi/vim editing?
Discover ViEmu's sister product, Codekana:
Codekana outliner and syntax highlighter