Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 3 down vote accepted

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

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

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 {} +
share|improve this answer

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.

share|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

You must log in to answer this question.

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