Discussion:
Remove leading spaces
Peter Anderson
2007-03-19 05:04:54 UTC
Permalink
Hi! I am new to this forum and new to EditPlus. As a bit of
background, I've recently ditched TextPad after years of use because
of the off-hand attitude of the developers and poor quality of latest
releases.

EditPlus seems to be very close to TextPad in many ways but I can't
find an easy way to delete leading spaces from text files.

Any help would be most appreciated.

Regards,
Peter



------------------------ Yahoo! Groups Sponsor --------------------~-->
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/0It09A/bOaOAA/yQLSAA/spZplB/TM
--------------------------------------------------------------------~->

http://www.editplus.com
DZ-Jay
2007-03-19 09:17:22 UTC
Permalink
There are a few ways:

Unindent:
1. Select all (CTRL+A)
2. Unindent all to the left margin (SHIFT+TAB)

RegExp:
1. Open up the Search + Replace window (CTRL+H)
2. enter the following in the "Find:" line: ^ + (that's "a caret
followed by a single space, followed by a plus sign").
3. Leave the "Replace with" field blank.
4. Make sure to tick the box that says "Regular Expression"
5. Click "Replace All".

Column Select:
1. select the columns that you want to clear (CTRL+LEFT-CLICK-DRAG).
2. Hit the Delete key.


The first solution will squash all indentation, moving all text to the
left margin.

The second one is probably more versatile, as it actively searches and
removes all leading spaces from the line.

As a bonus, if you want to remove spaces and tabs too, substitute the
"Find" expression with this "^[ \t]+" -- that is "a caret, followed by
square-left-bracket, followed by a single space, followed by backslash,
followed by the letter 'T', followed by a square-right-bracket,
followed by a plus sign." The caret represents an anchor at the
beginning of the line and the square brackets represent a character
range (any character in the set). The plus sign represents one or more
matches. In all, it means "Match any amount of spaces (or tabs), one
or more, starting from the beginning of the line, and replace them with
an empty string."

The third solution is only applicable if all lines have the same amount
of indentation.

Hope this helps!
dZ.
Post by Peter Anderson
Hi! I am new to this forum and new to EditPlus. As a bit of
background, I've recently ditched TextPad after years of use because
of the off-hand attitude of the developers and poor quality of latest
releases.
EditPlus seems to be very close to TextPad in many ways but I can't
find an easy way to delete leading spaces from text files.
Any help would be most appreciated.
Regards,
Peter
--
Do daemons dream of electric sleep()?



------------------------ Yahoo! Groups Sponsor --------------------~-->
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/0It09A/bOaOAA/yQLSAA/spZplB/TM
--------------------------------------------------------------------~->

http://www.editplus.com
Peter Anderson
2007-03-19 23:15:36 UTC
Permalink
dZ,

Method 2 is just what I was looking for. Now I will work out how to put that into a macro and it will be perfect.

I must say how impressed I am with EditPlus; its always a bit difficult when you give up something that you have used for many years and become very familiar with. But EditPlus is making the move quite easy. I have just about finished moving all my TextPad Clip Libs across to EditPlus Cliptexts.

Many thanks,
Peter


---
Peter Anderson

There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things. Niccolo Machiavelli, The Prince, ch. 6
Send instant messages to your online friends http://au.messenger.yahoo.com

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~-->
Great things are happening at Yahoo! Groups. See the new email design.
http://us.click.yahoo.com/lOt0.A/hOaOAA/yQLSAA/spZplB/TM
--------------------------------------------------------------------~->

http://www.editplus.com
DZ-Jay
2007-03-21 08:50:32 UTC
Permalink
Post by Peter Anderson
I must say how impressed I am with EditPlus; its always a bit
difficult when you give up something that you have used for many years
and become very familiar with. But EditPlus is making the move quite
easy. I have just about finished moving all my TextPad Clip Libs
across to EditPlus Cliptexts.
I understand perfectly. I am also a fellow ex-TextPad user; but when I
discovered EditPlus I never looked back. Its been quite a few years
now.

dZ.
--
Time flies like the wind...
Fruit flies like bananas.



http://www.editplus.com
Loading...