Friday, May 17, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1804  / 3 Years ago, mon, september 13, 2021, 6:25:38

My python file:


print('HelloWorld')

After executing the file in terminal history:


HelloWorld
Press ENTER or type command to continue

This is fine.


Now, if I then run the file again, it shows the previous history as well.


HelloWorld
Press ENTER or type command to continue
HelloWorld
Press ENTER or type command to continue

It should only return one 'HelloWorld', and clear the past history.


Please help.


More From » command-line

 Answers
6

You need to add a clear before each external command you run. For example, with ls, that would be


:!clear;ls

It would admitedly be pretty clumsy to type that for each command, so a map can be added in .vimrc. For example,


noremap ! :!clear;

will map ! in normal and visual modes. (That overrides the default ! behavior. If you do not want to override default maps, use one of the unused keys instead.)


[#2156] Wednesday, September 15, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gliroopy

Total Points: 290
Total Questions: 115
Total Answers: 114

Location: Egypt
Member since Tue, May 3, 2022
2 Years ago
;