ViEmu Blog

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

Archive for the ‘misc’ Category

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.

Changes in ViEmu home page, testimonials, and cool vi/vim screencast

Thursday, December 13th, 2007

A couple of things I just posted about on the ngedit blog:

  • I’ve changed the design of the ViEmu home page to include a sidebar with goodies, including a link to a new testimonials page. Read about it here.
  • Aaron Jensen has put up a cool screencast teaser for some vi/vim tutorials he’s preparing. A link and more details here. Awesome!

ViEmu status bar in Word & Outlook

Tuesday, December 11th, 2007

One recurring complaint about ViEmu/Word&Outlook is that its status bar obscures the bottom side of the document being edited. The status bar is the pale yellow line that shows the current mode (“–NORMAL–“, for example), and partially typed commands (be they normal mode commands, ex commands or even ‘/’ or ‘?’ searches).

This problem is more severe with Outlook, because Outlook disables scrolling beyond the end of the document. Technically, it’s because Outlook  uses the “Web layout” view mode of Word’s visualization engine, which causes this problem. But anyway, Word editing is usually done in “Print layout” or “Normal” view modes, so you can always scroll a bit to unobscure the area of interest.

I’ve been researching methods to avoid this problem. The main possible solutions I’ve come up with for Outlook 2003 revolve around putting the status bar somewhere else – namely, on top of Word’s own status bar, or on top of a special toolbr which would be docked at the bottom of the editing window. I’m investigating using the Word status bar first, as this looks more sensible and sensible. I’ll need to put the input somewhere where it won’t obscure the built-in status bar information areas, which will probably involve pushing to the right. Not the best solution, but possibly fine.

I already have some prototype code mostly working in this way, and it definitely helps. I still have to make sure it handles all conditions correctly, that it works fine with split-view windows, etc… It will all be configurable in the end, so it will only be a net win.

The best solution would be to stash it in a dockable toolbar, but I’m not all too sure whether I can configure a special control on one of this toolbars. I will investigate it though.

The main problem with this approach, though, is Outlook 2007. Outlook 2007’s mail composing window is actually a kind of container for a Word-engine window. It works fine, and it’s actually cleaner than the way Outlook used Word in previous versions, but it also means it uses Word 2007’s ribbon interface. And here comes the problem: I have been unable to make it show either a status bar, a toolbar docked at the bottom, or anything else for that matter. This means there is no place where I can overlay ViEmu’s status bar. I’ve gone through Outlook’s mail editor settings several times now, and I’ve found no “Show Status Bar” option. Bringing up a toolbar also seems impossible – the current interface paradigm seems to have gone out of its way to remove them.

One possibility is to have a “floating” status bar below the window. It would be a top level window, which would probably have to disappear when focus is lost by the editing window. This will not be nice, but it will work – as long as you don’t maximize Outlook. If you do maximize it,  then the status could end up anywhere: on top of the horizontal scroll bar, on top of the windows task bar… who knows.

Anyway, if anyone of you has an idea on a better way to approach this, please share it with me.  This is something I want to address as properly as possible, and I’ll be happy to give some thought to all suggestions.

Once this issue is addressed, I plan to do a few improvements to ViEmu/W&O and release version 1.1. It’s about time ViEmu/W&O leaves 1.0 status (technically, it’s in 1.0.23 now, so a far cry above a fresh 1.0 release, but anyway).

ViEmu and Visual Assist under VS2008

Friday, December 7th, 2007

I’ve just fixed a problem in ViEmu/VS that happened when Visual Assist is installed under VS2008. ViEmu wouldn’t work properly in XAML files in this setup – you’d get the block cursor, but vi commands wouldn’t work – keys would just type normally, and Esc wouldn’t exit this pseudo-insert mode.

This has happened in the past with HTML and XML files under previous versions of Visual Studio. The reason is the following: ViEmu works by hooking editor windows (subclassing in Win32 terminology) and intercepting keypresses to do its thing. When Visual Assist is present, ViEmu has to intercept the window after Visual Assist. The reasons is that, if not, Visual Assist might process a ‘b’ keypress, assume it means you’re typing, and pop up an autocompletion dropdown with types starting with ‘b’ (bool, etc…). But actually, this ‘b’ was done in normal mode, and ViEmu will just move the cursor to the beginning of the previous word.

As you can easily see, ViEmu needs to process the ‘b’ keypress first, and it ensures it doesn’t proceed and isn’t processed by either Visual Assist or VS’s own system. For this to work fine, we have to get the keypress before Visual Assist.

Well, Visual Assist is notoriously unpredictable as to when it will hook the window itself. It does it at some point after loading the file, but it can be either immediately or a few seconds after loading it. It’s probably parsing or loading or doing whatever in the background.

Well, the Visual Assist devs were so kind as to provide a way by which you can check whether they have already subclassed the window. Having this, ViEmu was able to just query it and not hook the window until Visual Assist has. Of course, I need to detect whether Visual Assist is installed, because, if not, the check to see if they have subclassed it will make ViEmu wait forever.

The additional problem is that Visual Assist doesn’t hook *all* text editing windows. For example, it doesn’t act at all on HTML & XML windows. So, in the case of this file types, I have to identify them, and *not wait* for Visual Assist. The way I do this identification is by asking Visual Studio which language service is handling the window. If it’s XML, HTML, XMLA, etc… then I just don’t wait for Visual Assist hooking even if we have detected Visual Assist is installed.

You can see how this is getting pretty hairy.

Ok, the final drop that causes the problem is that Microsoft keeps adding new language services for XML, XAML, and similar formats in each version of Visual Studio. When they do this, the end result is that ViEmu gets stuck and non-functional in the new XML-variants. And I have to add a new langsvc to the list of exceptions and put out a new build of ViEmu/VS.

This is what I just did, ViEmu/VS version 2.1.17, which works just fine in the above combination. Hopefully I have covered all new such cases in VS2008 (XAML and XOML, and don’t ask me, I don’t know what XOML is, but it’s in the list of new language services in VS2008’s registry hive). Here is the link to download it:

Remember you have to manually uninstall the previous 2.1.x version before installing this one.

And, incidentally, this is the same reason of another problem that comes up every few months: if you have ViEmu and a Visual Assist X trial installed, and if the VAX trial expires, ViEmu will stop working. This is because ViEmu detects Visual Assist is present, it will decide to wait for VAX-hooking on all windows, and they will never actually get hooked, because the VAX has stopped working. It would be cool if there were a way to detect the VAX is non-functional, or whether VAX is planning to hook a given window, but unfortunately there isn’t (or I have failed to come up with one).

Ah the joys of 3rd party plugin compatibility.

ViEmu/SQL with the new SQL Server 2008 (“Katmai”)

Wednesday, December 5th, 2007

I’ve just tested ViEmu/SQL Server with the latest CTP (‘Community Technology Preview’) of SQL Server 2008, codenamed “Katmai”. This latest CTP was released in November, and the final product is expected to be ready some time in early 2008.

The latest build of ViEmu/SQL on the web site (2.1.15) didn’t work right away, but it was just a matter of upgrading the installer to write its registry settings to the specific hive (branch) for the new product. I did just that and it works like a breeze. I’ve built a new revision, ViEmu/SQL 2.1.16, which hooks itself both into SQL Server 2005 and SQL Server 2008. I’ve just uploaded it:

Remember, you have to manually uninstall the previous version of ViEmu/SQL before installing this one.

I will promote this build to ‘official latest’ after it’s been up for a few days.

It’s very likely that this will be the only change needed to make it work with the final build of SQL Server 2008, but in any case I will watch out for any changes that require upgrading ViEmu. Just drop me a line if you stumble into a problem.

And happy SQLing with vi/vim keybindings!

ViEmu (and Codekana) in VS2008 on Vista X64

Monday, December 3rd, 2007

Someone asked about whether ViEmu would work fine with the new VS2008 in a 64-bit environment. I just tested it today, and it works just fine. The installer complained about a failed operation at the end, with Vista whining about it “requiring elevation”, but I just clicked ok, started VS2008, and ViEmu was there fine. I’m still quite puzzled with Vista’s byzantine and seemingly useless security mechanisms. Hopefully I’ll understand them better as time passes. But meanwhile, all of my products seem to work fine under both Vista x86 and Vista x64. Drop me a line if anything causes trouble.

A funny story about the Vi Gang Sign

Tuesday, November 20th, 2007

Yesterday, I posted a funny story about the Vi Gang Sign to my NGEDIT blog:

I thought I’d link to it from here in case you’re interested (not fully ViEmu-related, but definitely vi/vim-related).

Visual Studio 2008 and ViEmu (and Codekana)

Tuesday, November 20th, 2007

Yesterday, Microsoft released the final (RTM) version of Visual Studio 2008 (codename “Orcas” until now).

As soon as I got the announcement, I downloaded it using MSDN Subscriber access in order to test it with both ViEmu and Codekana. I’ve installed it today, and I can say that both ViEmu and Codekana work perfectly fine with this.

The installer supported the betas/CTP versions so far, so if you’ve installed ViEmu or Codekana in the past few months, they will be right there the first time you start Visual Studio 2008. No hassles at all.

To my C++-accustomed enfvironment, it just looks identical to VS2005 at first sight. Microsoft has announced they’ll release a pretty big update to VS2008 in the first half of 2008, including some improvements to the native C++ compiler and to MFC. But they’re saving the best bits for the next version of Visual Studio (VS2010?), including a totally revamped C++ compiler front-end and a new code model for C++ while editing. Details are not totally clear yet, but it seems this release will finally be compelling to native C++ programmers (unlike VS2005 and VS2008, and if I may say so, even VS.NET 2002/2003 themselves!). I’ll keep watching out on what this all may mean for ViEmu and Codekana.

By the way, the MSDN Subscriber download manager has been updated, from the old but very good Windows native application… to a pretty good but ugly Java-based download manager! I was quite shocked to see the Sun and Java logos come up as soon as I clicked on the download button 🙂

If you start using VS2008 and find any glitch, just let me know by email or through the support page, and I’ll have a look into it.

Welcome to the new ViEmu blog

Tuesday, November 6th, 2007

Welcome to this new blog. I’ve long wanted a blog where I could provide fresh information on ViEmu. I’ve had a blog at for a long time, but I felt that wasn’t a good place for very specific ViEmu information: most of the readers there are more interested in ViEmu as a growing business, and my various other projects.

But there’s still a host of ViEmu-specific things I’ve wanted to write about, and I needed a proper place for them. This is blog is that place, mainly oriented towards current and future users of ViEmu, and I hope you will find the contents useful and enjoyable.

In principle, I will be announcing new releases, detailing development progress, and in general commenting on all things ViEmu. Probably also dropping the occasional rant about how Visual Studio or Word won’t let me do what I want.

As always, I’ll be happy to hear any specific feedback you might have regarding this new resource and ViEmu in general.


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