Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

'vimdiff a b' always prints "2 files to edit". I don't want to see that. How can I avoid it?

Here is an example:

⚡ vimdiff  a b                                                                                                                               
2 files to edit

I want to use vimdiff from a bash script and don't want to see this output

share|improve this question
    
You could of course just launch it with 2>/dev/null. Why do you need this?It seems like such a minor annoyance. Oh, on a completely irrelevant note, could you share your $PS1? What is the character you are using as a prompt? – terdon Feb 1 '13 at 14:55
1  
vimdiff a b 2>/dev/null does not work for me. – Eric Johnson Feb 1 '13 at 15:00
    
I'm just sticking the unicode character in there. My $PS1 is defined here: github.com/kablamo/dotfiles/blob/master/links/.bash/prompt.sh – Eric Johnson Feb 1 '13 at 15:02
    
Nice, thanks :). And you're right, redirecting STDERR does not seem to work. I thought it did, but I just didn't see the line. – terdon Feb 1 '13 at 15:12
    
The answer seems to be here. Make sure to read the comments. – terdon Feb 1 '13 at 15:21
up vote 1 down vote accepted

Looking through the vim source, it looks like that message can only be suppressed when launching the executable as ex and using its -s option, or by not having a console.

Neither approach will work for diffing.

However, the message is only output if there is more than one file specified on the command line.

So let's trick it:

vim a -c "vert diffsplit b"

Which basically says "Edit file a with vim, and once a is loaded, open a vertical split with file b and diff them".

share|improve this answer
    
Hey that works! Awesome, thanks! Now I have remember where it was that I wanted this. Good news is I think its still useful info for me. – Eric Johnson Aug 29 '14 at 17:01

Set in your .vimrc

set shortmess=at

More tips and triks.

share|improve this answer
1  
This does not work for me. I suspect this only affects messages inside vim not on the commandline. – Eric Johnson Feb 1 '13 at 15:03

According to this post on SO, setting this in your vimrc should do the trick:

set shortmess=filnxtToO
share|improve this answer
1  
Sorry this doesn't work for me either even when I use --noplugin. I still get a msg. I'm not talking about the msg in the editor. After you close the editor, there is a msg and thats what i want to get rid of. Thanks though – Eric Johnson Feb 2 '13 at 13:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .