Qiang Li
Qiang Li

Reputation: 10855

terminal formatting issue after vim

I had ~3000 files in a directory with the name "build.xml", and when I did

find ./ -name build.xml|xargs vi

I then quit vi, and I see the formatting on the terminal got messed up. I cannot see any keyboard input, and when I press return, I see the newline characters get eaten up.

[Fri Jun 21 20:41:58:~ ] $ [Fri Jun 21 20:41:58:~ ] $ [Fri Jun 21 20:41:58:~ ] $ [Fri Jun 21 20:41:58:~ ] $ [Fri Jun 21 20:41:58:~ ] $ [Fri Jun 21 20:41:58:~ ] $ [Fri Jun 21 20:41:58:~ ] $ [Fri Jun 21 20:41:59:~ ] $ -bash: ks: command not found
                                                                                  [Fri Jun 21 20:45:08:~ ] $ 

What is happening here and how to fix it?

Upvotes: 2

Views: 90

Answers (2)

tylerl
tylerl

Reputation: 30847

Your shell could be doing something funny with I/O due to the | operator.

First of all, you can always reset your terminal by typing reset. But to avoid the issue, try using $() instead of piping to xargs. Like this:

vi $(find ./ -name build.xml)

Or

vi `find ./ -name build.xml`

Upvotes: 1

icktoofay
icktoofay

Reputation: 128991

Vim probably did not reset the terminal for some reason. Try using the reset command.

Upvotes: 3

Related Questions