Scott Hanselman

Simultaneous Editing for Visual Studio with the free MultiEdit extension

February 6, '13 Comments [47] Posted in Open Source | VS2012
Sponsored By

I use a number of text editors. The three I have pinned to my taskbar are Visual Studio, Sublime Text 2, and Notepad 2.

Visual Studio, Sublime Text, and Notepad2

I have three because I like features from one and wish those features were in another.

Sublime Text (and a few other editors) has a great feature called Simultaneous Editing. It's the very definition of an advanced - but core - editor feature.

Enter the MultiEdit extension for Visual Studio. Holding down ALT while mouse-clicking in the editor will add multiple selection points, so when you type, text will be added to all the selected positions. So today, MultiEdit supports multiple carets, but not multiple selections.

Here's an animated gif of MultiEdit in action.

This wonderful MultiEdit extension was released by the Visual Studio "Core Editor" Program Manager Ala Shiban (@AlaShiban). I'd like you guys to encourage our new friend with good reviews and nice comments if you like it. If you find a good bug, offer a clear bug report.

Perhaps if this thing gets a few hundred thousand downloads, we can get some new features, updates and more importantly show Ala's boss and make it a real live built-in feature. ;)

Version 1.0 supports:

  • Typing
  • Backspacing / Deleting
  • Moving the caret around using the keyboard
  • Undo-ing

What isn't supported:

  • Multiple selections
  • Virtual Spaces

Go get MultiEdit now for Visual Studio 2012 and then share it with all your friends.

Even better, perhaps we'll see even more "power toys" from the Core Editor team.

What would you like to see?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Wednesday, February 06, 2013 11:55:14 PM UTC
No support for VS 2010, for those of us who are still on version n-1?
Mike Loux
Wednesday, February 06, 2013 11:57:28 PM UTC
Yeah... VS 2010 support would be nice...
Wojtek Turowicz
Wednesday, February 06, 2013 11:58:19 PM UTC
Sublime Text has this feature from long time ago, is nice to see that we now have this feature on VS
Ernesto
Thursday, February 07, 2013 12:03:28 AM UTC
VS 2010... n-1... heck we're still running .net 2.0 on this major health project.
Ryan T
Thursday, February 07, 2013 12:42:25 AM UTC
that's great!

Thanks alot Now a days i am doing this kind of work.
Abu Ali Muhammad Sharjeel
Thursday, February 07, 2013 1:18:56 AM UTC
Nice, but how will it prevent one of the carets is misplaced?
Dayday Up
Thursday, February 07, 2013 1:21:57 AM UTC
Wow! Great for refactoring code.
Mike
Thursday, February 07, 2013 1:44:45 AM UTC
Hi Scott,
Yes, this is nice. Though for productivity I'd look more at something like R#.
Thursday, February 07, 2013 2:16:36 AM UTC
Honestly, if I could submit like 50 reviews for this plugin I would. I practically have tears of joy right now that this finally exists for VS!!! Happy Days!! Thanks for the heads up!
Thursday, February 07, 2013 2:28:33 AM UTC
I loved it, seriously! Thank you Ala!
Kim Tranjan
Thursday, February 07, 2013 2:50:10 AM UTC
It is not intuitive enough for end users to manual select which items to be edited in a batch.

I rather choose the SyncEdit mode as below,

http://www.skorkin.com/2011/06/how-to-implement-the-sync-edit-feature-from-delphi-ide-inside-visual-studio-ide-using-dxcore/#.URMV7idqnwk
Thursday, February 07, 2013 4:32:21 AM UTC
It looks cool, but only if you don't use Resharper.
uchitha
Thursday, February 07, 2013 5:32:57 AM UTC
Most of commenters seem to have no imagination. Stop with ReSharper and refactorings. This can be used in comments, Html, Xml, plain text, etc.

This is a MultiEdit tool not a refactoring one ;)
Donatas
Thursday, February 07, 2013 5:41:31 AM UTC
They, those are my three favorites too! Sublime Text 2 is my latest addition and is just incredible. Instead of Notepad2 though I use Notepad2-mod, which adds to Notepad2 an installer that can optionally replace notepad.exe, more syntax highlighting, bookmarks, and a few other tweaks.
Thursday, February 07, 2013 6:23:35 AM UTC
Hi, what I really would love to see, are realitime-collaboration Features in VS and especially the editor. Let's call it linked VS.

If you look at the Mac application SubEthaEdit, this is what I am thinking off. Would be great for pair programming when not at the same location. With a little bit of solution syncing multiple people could work at the same project, even in the same classes in real time.

The next step would be a remote-via-linked-VS-debugger, so that one person on his mashine is debugging, and I can join the very same debugging session, have all output (Trace, Immediate window) locally while inspecting his problem and hinting him.
Thursday, February 07, 2013 8:01:18 AM UTC
Thanks for sharing this !
Can't wait for the 2010 version (or for my employer to upgrade to 2012)
Melchior
Thursday, February 07, 2013 8:10:46 AM UTC
Well, I would just use VsVim and do:


:%s/search/replace


Where 'search' will be replaced with 'replace'. Optionally using /g or /c depending on what I wanted to achieve.
Thursday, February 07, 2013 10:58:04 AM UTC
Yes, resharper is great and can do this. Lots of VS users do not use resharper though.

Yes, VIM is great and can do this. Lots of VS users do not use VIM though.

Yes, it's currently only for VS2012. Lots of VS users are < 2012. Why not contact the author and offer some support to see if it can be extended for use on 2010?

Works great on my machine!
Sean
Thursday, February 07, 2013 1:49:52 PM UTC
Very Nice.
Thursday, February 07, 2013 3:14:20 PM UTC
This is awesome! RubyMine does this and I love it and missed it in VS. I never knew ReSharper could do this (SMH)

Although, I noticed R# can do Multiple Selections, but I couldn't figure out if it could do the Multiple Selection Points. But now, with the MultiEdit extension, I have both!

Thursday, February 07, 2013 3:43:34 PM UTC
This is very nice for some editing scenarios, most of the time I rather do several edits where the source definition of the class/member is and use the ContextMenu->Rename 'Abc' to 'Def' to propagate it.
I haven't installed this extension but from the demo above I think it would be nice if it could keep the text being typed highlighted for a bit of time (or until clicked elsewhere) to preview the multi-change.
Thanks!
Chris
Thursday, February 07, 2013 3:57:36 PM UTC
Like alt+dragmouse or alt+shift+pressdirectionkey feature that is already in Visual Studio, but more flexible!

For those unfamiliar with alt+drag you can select a block of code in Visual Studio, or a sliver. Here's an example of how selecting a sliver can save keystrokes. Say I have this code, and I want to make these properties public:

string Foo { get; set; }
int Bar { get; set; }

I can select the vertical sliver before "string" and "int" by holding down alt, then click dragging from in front of the "s" of string straight down to the "i" of int. Now that the invisible space before both of those lines is selected I can type "public ", and the result will look like this:

public string Foo { get; set; }
public int Bar { get; set; }


Hope that makes sense. I'm sure an animated gif would be easier to understand :)
Jeremy Cook
Thursday, February 07, 2013 4:26:39 PM UTC
Sebastian, I've thought about realtime multi-author source code editing, but problems arise when one developer wants to compile and test a feature when another developer is in the middle of writing code.

Add me to the list of people who'd love a VS2010 version of MultiEdit.
Mike C
Thursday, February 07, 2013 4:44:47 PM UTC
Excellent. Will download today and try it out. Very useful feature that I've become accustomed to in Sublime.
Thursday, February 07, 2013 5:06:41 PM UTC
This looks VERY useful. I will add my voice to those voting for a VS2010 version too.
Brian Schnackel
Thursday, February 07, 2013 6:01:29 PM UTC
Nice.... Thanks for passing this along. I really liked when the multi-line edit feature, similar to the functionality found in UltraEdit, was added to VS. This now puts it over the top. I think I'll get comfortable with this fairly quickly.
Thursday, February 07, 2013 6:02:49 PM UTC
I agree with Sean. There are TONS of ways to achieve this specific functionality, BUT the real point here is that the VS team is releasing cool updates that put together some of the "Lego" bricks including Duplo bricks.

I am all for this trend. Faster releases of smaller units that give us new capabilities (or the ability to create or incorporate new capabilities) without waiting years between releases.

Thanks Ala and team!
Thursday, February 07, 2013 9:05:46 PM UTC
Cool! Watch out for the trademark police though. www.multiedit.com (Wow, that's an ugly site.)
Elton
Thursday, February 07, 2013 9:08:03 PM UTC
This is rockin sweet to use Hanselspeak. The scenario in the animated GIF isn't even the one I'm thinking of (since as folks have pointed out, search-n-replace is likely the better choice for that specific case). The one that I would love it for is to add something to the end of jagged lines (where you can't quite use the 90 degree alt-select feature--we need Lasso Select).
Brian Hartung
Thursday, February 07, 2013 9:13:58 PM UTC
Example in this animated gif doesn't make much sense. You change the type names without really renaming them. So are you changing to different already existing types or what?
Please somebody show me example when this addon is useful.
Jiggaboo
Friday, February 08, 2013 3:02:06 AM UTC
if you are asking for other editor features then there is on huge omission: history tracking.

In other editors I can see the complete revision history of a file (for the edits I did). I can go back and selectively pick bits to put back, merge in old lines, even recover the entire file, compare versions etc.

This has saved me from many oops; big and small

This is in addition to source control.
pm100
Friday, February 08, 2013 12:32:15 PM UTC
Thnx for the heads up.
Txomin
Friday, February 08, 2013 2:29:20 PM UTC
I checked out the link and if this was the initial release I would say that "Click then Ctrl-V" is just as easy, maybe even better in the sense you can visually see each edit as it happens to prevent mistakes from misclicking your cursor in the wrong spot. But, the 1.1 update adds in backspacing, which ctrl+v obviously wouldn't do. Too bad you can't select multiple text blocks to edit all at once.
Friday, February 08, 2013 3:01:45 PM UTC
Or, you could do the same thing properly and without the possibility of putting your code into a non-compiling state by forgetting to click in a few places, and use the Rename refactoring
Jim Cooper
Friday, February 08, 2013 3:30:48 PM UTC
How is this more efficient than ctrl+H or shift+ctrl+H?
Mister Over
Friday, February 08, 2013 6:38:37 PM UTC
VS offers a somewhat closer thing already. Usually when you rename something, a little smart action glyph offers to rename rest of the occurences. Its limited, but usually suffices.

Plus the context swicth of going to the mouse, holding Alt and inserting the seletion point requires lot of precision, counteracting the proposed ease this feature is supposed to bring.

Between the smart action and Ctrl+H or Ctrl+Shift+H, I've never really missed this capability.
Hrusikesh Panda
Friday, February 08, 2013 10:40:32 PM UTC
VS also does search/replace with Regular Expressions and if you just highlight a section -- you can just edit the text in that area only.
William
Saturday, February 09, 2013 2:50:53 AM UTC
Folks, Notepad++ also has this feature. A user must enable it 1st in the Settings -> Preferences -> Editing tab.

The feature is called "Multi Editing" and IMO is even more flexible than in all of the aforementioned editors because it permits to make arbitrary text selection choices sparsely.

Scott, by the way, why one cannot log into the comments section using Twitter or Facebook?
Saturday, February 09, 2013 6:21:01 AM UTC
On my wish list for the VS Editor: Macro/Keystroke Recorder. This was removed when macros were removed in VS2012. There is an extension on github that attempts to restore this feature, but it doesn't work with find operations and it looks like lower level access is required to bring this functionality back fully.
Joel Harris
Saturday, February 09, 2013 7:46:45 AM UTC
Awesome extension. Like it!!
Saturday, February 09, 2013 3:46:12 PM UTC
Nice extension, but too bad it doesn't initiate the rename dialog(s). That really limits my use of it.

I will definitely recommend it and hope for that rename feature.
Vegio
Monday, February 11, 2013 10:09:08 AM UTC
Wonderful, love it in Sublime. Thanks for sharing
Fabrizio
Monday, February 11, 2013 4:19:48 PM UTC
good stuff
notepad ++ with all its plugins became the most kick ass editor for me as developer .
Sam
Tuesday, February 12, 2013 5:03:49 PM UTC
This reminds me of the refactoring tools in IntelliJ Idea and the "Edit all in scope" feature in XCode. (I hate XCode by the way.) While the immediate use case is the typical "rename all in scope" I would love to see/learn other scenarios or usage of such a feature. Many times the magic of tools like this come in unexpected use cases. I remember when I learned how to effectively use column edit and then recently learning how to use it for a new easter egg I'm planning.
Tuesday, February 19, 2013 4:01:07 PM UTC
Thanks for sharing Scott, but honestly I can't think of how this is useful at all. With the new editing feature in VS2012 like column selection, with a the always good search and replace features which include Regex support, and the basic but useful refactoring support as well this extension seems useless. This is without even thinking about what R# adds. Also I believe there are other more powerful and free editor extensions that bring VIM like features for those hard core text editor folks that would be far more useful.

Normally when you share you provide solid real examples of why what you are sharing is useful to you. However here you didn't do any of that, and the example provided is pedantic and not real world at all.
Rodney
Friday, February 22, 2013 8:42:09 PM UTC
Your plugin is really nice but It causes problems when with the zen-coding plugin. Ist there a setting a fix for that?
Jesse
Wednesday, November 06, 2013 9:31:53 PM UTC

Real-Time Live Collaboration/Simultaneous Editing IN Visual Studio is support by VS Anywhere Add-In for Visual Studio 2010/2012/2013, is not just limited to code as you can work on design view for XAML/WPF, Windows Forms, HTML and ASPX , support to share a full solution, a project or a isolated file, has support for Lync and TFS, including using them as Credentials Providers, integrates with Skype for VoIP and has other interesting features, like for instance integration with Github (and soon with other Social Coding providers)

you can see VS Anywhere in action here: http://www.youtube.com/watch?v=f7epkbVuEYc
the web site is https://vsanywhere.com

Hope this information is a helpful for all you looking for this kind of features,

Regards
Jesus
VS Anywhere
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.