3

I'm playing with ex and I've found that removing trailing spaces for multiple files in silent mode doesn't work as expected.

The following examples doesn't work as expected (whatever I use argdo or bufdo):

$ ex -s +'argdo! %s/\s\+$//e' -cxa *.*
$ ex -s +'bufdo! %s/\s\+$//e' -cxa *.*
(nothing is changed)

My files have trailing spaces as I've tested in git repository, so I could easily check the changes via git diff. And in addition exactly the same command (without -s) works as expected:

$ ex +'bufdo! %s/\s\+$//e' -cxa *.*
7 files to edit

What's more unexpected, silent mode works for other example such as:

$ ex -s +'bufdo! %s/foo/bar/e' -cxa *.*

What I'm doing wrong?

Debugging with -V10 doesn't give me much useful information I guess.

  • Sounds to me like its a bug. – jecxjo Apr 20 '15 at 19:22
  • 3
    vi -es +'bufdo! %s/\s\+$//e' -cxa ... works here – guido Apr 21 '15 at 4:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.