Command to remove all white space?

Command to remove all white space?

Postby Jamie on Wed Mar 03, 2010 1:45 pm

Is there a function to remove all white space/compress my code? I seem to be missing this feature and figure I am just overlooking it somewhere.
Jamie
 
Posts: 5
Joined: Wed Dec 09, 2009 1:52 pm

Re: Command to remove all white space?

Postby protoplasm on Wed Mar 03, 2010 1:57 pm

It may not satisfy your needs, but to remove all white space you could press CTRL+H to bring up the Find & Replace panel, then make sure that regular expression button is toggled (it's labelled .*), then have the following in the input fields:

Find what: \s
Replace with:

That is, an empty input replacing it. It performs a bit slowly on my machine, mind you.
protoplasm
 
Posts: 23
Joined: Tue Oct 20, 2009 4:47 pm

Re: Command to remove all white space?

Postby Jamie on Wed Mar 03, 2010 2:01 pm

Perfect! Thanks so much. Wish I could just make that a button, but this serves the purpose. It's a little slow on the current file, but its 1400 lines, which won't be the usual.
Jamie
 
Posts: 5
Joined: Wed Dec 09, 2009 1:52 pm

Re: Command to remove all white space?

Postby gpfsmurf on Wed Mar 03, 2010 9:06 pm

You can try the RemoveWhitespace plugin
gpfsmurf
 
Posts: 181
Joined: Mon Jun 23, 2008 6:31 pm

Re: Command to remove all white space?

Postby capnhud on Fri Mar 05, 2010 11:58 am

is there anyway to control this removal process so that markup such as the following:
<ul>
<li><a href="#">SubVert Item 1</a></li>
<li><a href="#">SubVert Item 2</a></li>
<li><a href="#">SubVert Item 3</a></li>
</ul>

becomes:
<ul><li><a href="#">SubVert Item 1</a></li><li><a href="#">SubVert Item 2</a></li><li><a href="#">SubVert Item 3</a></li></ul>


instead of:
<ul><li><ahref="#">SubVertItem1</a></li><li><ahref="#">SubVertItem2</a></li><li><ahref="#">SubVertItem3</a></li></ul>

notice the difference in the <a href>
capnhud
 
Posts: 37
Joined: Thu Jan 14, 2010 11:57 am

Re: Command to remove all white space?

Postby EJ12N on Fri Mar 05, 2010 11:51 pm

capnhud wrote:is there anyway to control this removal process so that markup such as the following:
<ul>
<li><a href="#">SubVert Item 1</a></li>
<li><a href="#">SubVert Item 2</a></li>
<li><a href="#">SubVert Item 3</a></li>
</ul>

becomes:
<ul><li><a href="#">SubVert Item 1</a></li><li><a href="#">SubVert Item 2</a></li><li><a href="#">SubVert Item 3</a></li></ul>


instead of:
<ul><li><ahref="#">SubVertItem1</a></li><li><ahref="#">SubVertItem2</a></li><li><ahref="#">SubVertItem3</a></li></ul>

notice the difference in the <a href>


remove new lines only \n
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Command to remove all white space?

Postby capnhud on Mon Mar 08, 2010 1:59 pm

remove new lines only \n


That works perfectly. Thanks EJ12N
capnhud
 
Posts: 37
Joined: Thu Jan 14, 2010 11:57 am

Re: Command to remove all white space?

Postby capnhud on Sat May 15, 2010 5:39 pm

just one more question concerning removing white space. I can remove newlines which is good, but how would you trim the whitespace that is between subsequent text and tags.
ex:
<ul>
<li><a href="#">SubVert Item 1 </a> </li>
<li><a href="#">SubVert Item 2 </a> </li>
<li><a href="#">SubVert Item 3 </a> </li>
</ul>

becomes:
<ul><li><a href="#">SubVert Item 1</a></li><li><a href="#">SubVert Item 2</a></li><li><a href="#">SubVert Item 3</a></li></ul>
capnhud
 
Posts: 37
Joined: Thu Jan 14, 2010 11:57 am

Re: Command to remove all white space?

Postby gpfsmurf on Sat May 15, 2010 8:54 pm

Try Ctrl+J (join lines)
gpfsmurf
 
Posts: 181
Joined: Mon Jun 23, 2008 6:31 pm

Re: Command to remove all white space?

Postby capnhud on Sat May 15, 2010 9:00 pm

Try Ctrl+J (join lines)


I tried that, but that has not affect on the extra spaces that are present once you remove the new lines.
capnhud
 
Posts: 37
Joined: Thu Jan 14, 2010 11:57 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest