I typed this command in putty, where thereis only one file, filename: find . -name filename | xargs vim

after I close vim, I cannot get a new line in putty, unless I press Ctrl+C user@ubuntu:~$ user@ubuntu:~$ user@ubuntu:~$

how can I fix this (other than opening a new shell in putty) ?

Thanks

link|improve this question

53% accept rate
feedback

3 Answers

up vote 2 down vote accepted

The terminal emulation has been corrupted. I have found that I can fix this by blindly typing reset<ENTER>

link|improve this answer
many thanks! :) – portoalet Dec 26 '09 at 15:29
feedback

Using find, xargs and vim in that combination makes a horrible mess of your terminal.

If you want to use the output of find for vim, the following works:

find . -name filename -exec vim {} +
link|improve this answer
feedback

You shouldn't really pipe into vim, interactive programs really need to be controlled by a tty, not a pipe.

Try "Ctrl+J stty sane Ctrl+J". This will setup your terminal with a default set of settings, which are usually close to what you want. You have to press Ctrl-J to get a newline, because the mode which translates enter to the end of line has been turned off.

link|improve this answer
He isn't - he's piping to xargs. – grawity Dec 24 '09 at 16:34
And then vim is then going to inherit the pipe as stdin. If you run the command you'll find that you get the error Vim: Warning: Input is not from a terminal – gorilla Dec 25 '09 at 0:43
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.