Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a mechanism within notepad++ to replace runs of consecutive whitespace with a single space, like the "Compress whitespace" command in notepad2.

Essentially, in regex form:

s/\s+/ /g

I know I can do it with the find-replace form, but I would prefer soemthing that I can bind to a keyboard sequence.

EDIT

Find and replace cannot be recorded as a macro in some versions of Notepad++. Update to the latest if you have trouble.

share|improve this question
up vote 4 down vote accepted

You should be able to set this regex up as a macro and then bind the macro to a shortcut.

Settings > Shortcut mapper... > Macros

share|improve this answer
    
For whatever reason, I can't save the act of using the find-replace dialog as a macro. – tylerl Feb 14 '11 at 19:16
    
@tylerl when I do start recording, then do a find/replace of abc to xyz, then stop recording. then write in abc , then click macro..playback, it plays it back. so it does record. and I see an option to the current macro – barlop Feb 14 '11 at 20:31
    
@barlop - Doesn't work here. I do start recording, then find-replace, then stop-recording -- my macro isn't saved. It's as if I hadn't done a find-replace. The Playback option is grayed out. – tylerl Feb 14 '11 at 23:02
    
@barlop - Updated notepad++ to the latest version, and it works now. Thanks. – tylerl Feb 14 '11 at 23:05

Edit > Blank Operations > Remove Unnecessary Blank and EOL

Not sure if that's a default feature or plugin, but there's always a million plugins to do anything else.
The TextFX Plugin is worth a look as well.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .