3

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

3 Answers 3

3

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

0
2

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 {} +
0

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.

2
  • He isn't - he's piping to xargs. Dec 24, 2009 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, 2009 at 0:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .