Clear screen before bang (!)

Viewed 3644

I would appreciate if some one can figure how to clean screen when I do i.e.:

:!git status

It always show me the previous output, so if I repeat this task many times can confuse me because I see the history.

With an external keyboard usually I do :!git status + ctrl+K+enter but for unknown reason on my internal keyboard (macbook pro) didn't do the trick.

There is a best way to do that? Maybe in vimrc.

Thanks guys!


Finally I figure how we can do that with built-in terminal.app. Write :!your command then press CMD + K + ENTER and you see a clean screen!

3 Answers

If you don't want to type

:!clear; git status

every time (I didn't) so maybe just a slightly better option is to go to your ~/.vimrc and add

command! -nargs=1 R :!clear && <args>

I chose "R" because I thought of the word "Run". It could be any uppercase letter you want or it could even be "Run". You would use it like"

:R git status

And then when you run it again, it will not show the previous Foo! in the terminal. I would say it is almost as easy to type "!". Just a thought!

Related