In a previous post I discussed MacVim Services on Mac OS X 10.5 (Leopard) and earlier. With Mac OS X 10.6 (Snow Leopard) Apple has polished Services to make them more easily accessible, but unfortunately this broke some of the MacVim Services at the same time. As of Snapshot 52 (released today!) MacVim Services work on Snow Leopard and in this post I’ll quickly demonstrate how they can be put to good use.
MacVim now exposes two Services: “New MacVim Buffer With Selection” and “New MacVim Buffer Here”. Both can be accessed in the usual (pre-10.6) manner via the Services submenu of the current applications menu, or via a context menu that pops up when you control-click (or right-click) something. The context menu is new in Snow Leopard and makes it so much easier to access Services.
The first Service (New MacVim Buffer With Selection) is available when you control-click the selection in any application (e.g. Safari). When used it will copy the selection, open a new MacVim buffer, and paste the selection into the buffer so you can start editing it.
The second Service (New MacVim Buffer Here) is available when you control-click a file or folder inside a Finder window. When used it will open a new MacVim buffer and set the current directory to that of the file or folder you had selected. This can be handy if you’ve browsed to some folder in the Finder and want to create a new text file inside that folder: simply control-click on any file in the folder, select the Service, add some text, then type :w filename to save the buffer in a file called filename in the folder you had open in the Finder.
Finally, if you don’t want these menu entries clogging up your context menus there is an easy way to disable them: open up System Services, click on Keyboard and select the Keyboard Shortcuts tab. In the left-hand list click on Services to bring up a list of avaiable Services in the right-hand view. Search for the Services you don’t want and untick them one at a time and they won’t bother you again.
Thanks! These are awesome additions, I’m happy you added support for :winpos, as the window by default never uses maximum vertical space, but going fullscreen isn’t practical on the larger iMacs.
Thanks for your excellent work. I’m running Snow Leopard and was hoping that snapshot 52 fixed the missing services issue, but it doesn’t, at least on my system. What should I try?
Did you get this figured out? I had the services on my computer but now they are gone. It makes me sad.
Services should work … I have never had any problems with them. I added a note on how to debug problems with services in an earlier comment and I can’t really be of much more help than that.
Please direct any further questions about MacVim to the vim_mac Google Group. It makes things easier for me. Thanks.
Kyle: I don’t know why services are not working for you but I can tell you how to try to debug the issue yourself. Go to [1] and read the section called “Testing”. It may give you an idea as to what is going on. If you need more help with this, or if you have any more comments on this issue please report them to the vim_mac mailing list [2] instead of here. Thanks!
[1] http://developer.apple.com/mac/library/documentation/cocoa/conceptual/SysServices/Articles/providing.html
[2] http://groups.google.com/group/vim_mac
So, where’s the PayPal Donation button?
At the moment I am not taking donations for the MacVim project itself, but encourage you to donate to Vim instead to show your support:
http://www.vim.org/sponsor/index.php
Thanks!
Björn
Hi,
I’d like to donate to you. I am currently using macvim under os 10.4. I tried to compile the latest version from your sources, but no luck.
Any idea when a 10.4 for us ppc users?
Thanks and let me know if you will still take a donation.
Russ Urquhart
I have built a version of MacVim 7.3 for OS X 10.4 today. You can download it from here.
I have also added a Pledgie badge to the GitHub page for anybody wishing to show their support. Note that I strongly urge everybody to donate to Vim before donating to MacVim specifically — the work I have put in compared with what Bram has does not amount to much and money donated to Vim goes to a good cause. I will use donations for upgrades to my computer and if I get more than I need I will pass it on to the Vim charity.