Anything that removes extra spaces before end of lines?

Here you can discuss about your favorite plug-in.
Post Reply
kamil
Posts: 44
Joined: Fri 13 Apr, 2012 19:19
Has thanked: 8 times

Anything that removes extra spaces before end of lines?

Post by kamil »

I was wondering if you know any editor plugin that would remove extra spaces (and tabs) before end of lines?
Preferably also giving a warning when I try to save a file which has such unnecessary characters...

I hate opening my source files in vim and seeing such spaces highlighted in red.
User avatar
HaRT
Moderator
Posts: 10822
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Re: Anything that removes extra spaces before end of lines?

Post by HaRT »

There are lots of such plugins. The most mature and powerful is [ESC]. Of course, it does much more than that.
Фар есть инструмент, а не нянька. © 2009 DrKnS
kamil
Posts: 44
Joined: Fri 13 Apr, 2012 19:19
Has thanked: 8 times

Re: Anything that removes extra spaces before end of lines?

Post by kamil »

Thank you!
kamil
Posts: 44
Joined: Fri 13 Apr, 2012 19:19
Has thanked: 8 times

Re: Anything that removes extra spaces before end of lines?

Post by kamil »

But how do I setup Esc to do what I need?
The manual is only in Russian.
Shmuel
Posts: 6819
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Re: Anything that removes extra spaces before end of lines?

Post by Shmuel »

kamil wrote:I was wondering if you know any editor plugin that would remove extra spaces (and tabs) before end of lines?
Preferably also giving a warning when I try to save a file which has such unnecessary characters...

I hate opening my source files in vim and seeing such spaces highlighted in red.
Alternatively, you can use the following macro:
User avatar
HaRT
Moderator
Posts: 10822
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Re: Anything that removes extra spaces before end of lines?

Post by HaRT »

kamil wrote:But how do I setup Esc to do what I need?
The manual is only in Russian.
Configs are in English. :ha: Find “killspace” there.
Фар есть инструмент, а не нянька. © 2009 DrKnS
kamil
Posts: 44
Joined: Fri 13 Apr, 2012 19:19
Has thanked: 8 times

Re: Anything that removes extra spaces before end of lines?

Post by kamil »

Shmuel wrote:Alternatively, you can use the following macro
This is perfect and works just how I need.
Also I learned about lua macros, BTW :)

Thanks a lot!
kamil
Posts: 44
Joined: Fri 13 Apr, 2012 19:19
Has thanked: 8 times

Re: Anything that removes extra spaces before end of lines?

Post by kamil »

HaRT wrote:
kamil wrote:But how do I setup Esc to do what I need?
The manual is only in Russian.
Configs are in English. :ha: Find “killspace” there.
Oh - I see now... Just had to add my extension to esc_sources.xml :)

Cheers!
Shmuel
Posts: 6819
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Re: Anything that removes extra spaces before end of lines?

Post by Shmuel »

kamil
I've edited the macro.
Pay attention to filemask field. Set it according to to your preference. Do NOT include extensions of binary files there.
kamil
Posts: 44
Joined: Fri 13 Apr, 2012 19:19
Has thanked: 8 times

Re: Anything that removes extra spaces before end of lines?

Post by kamil »

ok, got you.
thx @Shmuel
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: Anything that removes extra spaces before end of lines?

Post by pepak »

A bit late, but I thought I would share it: I use regexps for this task, e.g.

search=\s+$
replace=
Post Reply

Return to “General Plug-In Discussions”