Tuesday, November 1, 2011

Re: function to apply multiple whole-file substitutions

* eda wizard <edawizard@telecom-digest.zzn.com> [2011-11-02 04:17]:
> I'm trying to craft a function to apply a series
> of pattern-matching substitutions to the file.
> So far I've got this in my .vimrc
>
> function Scrub ()
> :%s// /g
> :%s/\s*$//g
> endfunction
> map :call Scrub ()
>
> but it's not working,

the first substitution searches for *nothing*,
the second substitution *always* matches
(besides, when anchored at the EOL then there's only
one match - nothing to be repeated for more matches), and
the mapping looks like it is missing the left hand side.

was that your intention?

well.. we can't tell because we do not know the goal.

i suggest you give a description of your problem
and how you *intended* to solve it with a function.
then we might be able to correct your commands.

Sven

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment