Anything that removes extra spaces before end of lines?

Here you can discuss about your favorite plug-in.
kamil
Posts: 20
Joined: Fri 13 Apr, 2012 19:19

Anything that removes extra spaces before end of lines?

Postby kamil » Wed 08 May, 2013 14:36

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: 7954
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 66 times
Been thanked: 97 times

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

Postby HaRT » Wed 08 May, 2013 14:50

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: 20
Joined: Fri 13 Apr, 2012 19:19

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

Postby kamil » Wed 08 May, 2013 15:10

Thank you!

kamil
Posts: 20
Joined: Fri 13 Apr, 2012 19:19

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

Postby kamil » Wed 08 May, 2013 15:13

But how do I setup Esc to do what I need?
The manual is only in Russian.

Shmuel
Posts: 4998
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 132 times

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

Postby Shmuel » Wed 08 May, 2013 15:22

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:
Last edited by Shmuel on Wed 08 May, 2013 15:37, edited 1 time in total.

User avatar
HaRT
Moderator
Posts: 7954
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 66 times
Been thanked: 97 times

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

Postby HaRT » Wed 08 May, 2013 15:26

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: 20
Joined: Fri 13 Apr, 2012 19:19

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

Postby kamil » Wed 08 May, 2013 15:28

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: 20
Joined: Fri 13 Apr, 2012 19:19

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

Postby kamil » Wed 08 May, 2013 15:32

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: 4998
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 132 times

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

Postby Shmuel » Wed 08 May, 2013 15:39

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: 20
Joined: Fri 13 Apr, 2012 19:19

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

Postby kamil » Wed 08 May, 2013 15:48

ok, got you.
thx @Shmuel

pepak
Posts: 312
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 1 time
Been thanked: 9 times

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

Postby pepak » Thu 09 May, 2013 16:17

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

search=\s+$
replace=


Return to “General Plug-In Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest