Thank you. This works perfectly.

Gary Furash| [email protected] | 520-907-2470 | @CrabGary (twitter) |
http://gfurash.blogspot.com


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of ZyX
Sent: Thursday, May 05, 2011 12:08 PM
To: [email protected]
Subject: Re: Help w/ AutoCmd Error Message

Reply to message <Help w/ AutoCmd Error Message>, sent 22:45:43 05 May 2011,
Thursday by Gary Furash:

> 2. This seems to WORK fine, but when they're aren't any trailing 
> characters, it prints out an error message. I just want it to do its 
> thing and not tell me if there aren't any trailing characters to fix.
There are three ways of doing this:
1. General: use :silent! command:
    :silent! %s/\s\+$//g
2. General: use :try .. catch:
       :execute "try\n%s/\\s\\+$//g\ncatch /^Vim(substitute):E486:/\nendtry"
   (:execute is not required, but `try | ... | catch | endtry' may produce
   strange results).
3. :substitute-specific /e flag:
    :%s/\s\+$//ge

Original message:
> I checked the AutoCmd documentation and did not find a "silent" statement.
> 
> 1. I've added the following commands to my VIMRC for the purposes of 
> assuring (a) that documentation is always setup and (b) there aren't 
> any trailing characters
> 
> autocmd BufWritePre * :%s/\s\+$//g
> autocmd BufWritePre * :%s/^$\n^$//g
> autocmd VimEnter    * :helptags ~/.vim/doc
> 
> 2. This seems to WORK fine, but when they're aren't any trailing 
> characters, it prints out an error message. I just want it to do its 
> thing and not tell me if there aren't any trailing characters to fix.
> 
> Is there a way to silence the execution of these commands? Thanks.
> 
> 
> Gary Furash| [email protected] | 520-907-2470 | @CrabGary (twitter) 
> | http://gfurash.blogspot.com

-- 
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

Reply via email to