Loading ...
Sorry, an error occurred while loading the content.

end of line whitespace

Expand Messages
  • Robert Hicks
    I know that in some IDE s I can check a box that causes the IDE to automatically strip trailing white space. Does Vim have a switch to do that or do I need to
    Message 1 of 2 , Jan 2, 2007
    • 0 Attachment
      I know that in some IDE's I can check a box that causes the IDE to
      automatically strip trailing white space. Does Vim have a switch to do
      that or do I need to do:

      autocmd BufWritePre * %s/\s*$//e

      It would be nice to have a "set stripwhitespace" if that is the case but
      I guess that is the power of Vim.

      Robert
    • A.J.Mechelynck
      ... AFAIK there is no such setting, but your autocommand is the next best thing. OTOH you can _see_ end-of-line whitespace by setting the list and
      Message 2 of 2 , Jan 2, 2007
      • 0 Attachment
        Robert Hicks wrote:
        > I know that in some IDE's I can check a box that causes the IDE to
        > automatically strip trailing white space. Does Vim have a switch to do
        > that or do I need to do:
        >
        > autocmd BufWritePre * %s/\s*$//e
        >
        > It would be nice to have a "set stripwhitespace" if that is the case but
        > I guess that is the power of Vim.
        >
        > Robert
        >
        >

        AFAIK there is no such setting, but your autocommand is the next best thing.

        OTOH you can _see_ end-of-line whitespace by setting the 'list' and
        'listchars' options appropriately. For instance,

        :set list listchars=tab:\ \ ,eol:$

        displays the files as usual, but with a blue dollar sign (well, blue by
        default: a colorscheme can change that) just after the last character on each
        line.


        Best regards,
        Tony
      Your message has been successfully submitted and would be delivered to recipients shortly.