Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear screen before bang (!)

Tags:

vim

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!

like image 564
DAddYE Avatar asked Jul 30 '11 20:07

DAddYE


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!

like image 133
Sebastian Dix Avatar answered Oct 19 '22 17:10

Sebastian Dix


If you don't mind a little extra typing:

:!clear; git status
like image 11
hammar Avatar answered Nov 06 '22 21:11

hammar


What about using an external plugin for git? fugitive is a great one! Some more details and screencasts. It can show git status with :Gstatus (which you can map to some shortcut key...)

HTH

like image 2
Zsolt Botykai Avatar answered Nov 06 '22 21:11

Zsolt Botykai