Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

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>

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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