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
user@laptop:~$ locate file.ext | xargs vim -p
Vim: Warning: Input is not from a terminal
2 files to edit

After finding files and modifying them in vim I want to save them and continue to work in unix console but I can't do that.

After vim close console just halts. No activity on any keypress. The only workaround is to close console tab and create a new one. How can I solve this problem?

share|improve this question

migrated from Jun 18 '10 at 11:38

This question came from our site for professional and enthusiast programmers.

try to run it different way:

vim -p `locate file.ext`

or you can try to run reset command after your vim session, to reset terminal options to defaults:

locate file.ext | xargs vim -p; reset
share|improve this answer
great! thank you – Anonymous Jun 18 '10 at 10:05
please accept an answer by putting a checkmark sign under it if it helped you. thank you – zed_0xff Jun 18 '10 at 10:07
Don't use the second one, it's a hack; the first command is the idiomatic and correct way to do it. – msw Jun 18 '10 at 12:21

This is what I do, after exiting vim from a piped command on Cygwin.

stty sane {enter}

Of course, you won't see that get typed, but after you hit enter, the tty will come back to life. It's a pain, but works.

I don't like the other solution here because often I am running a much more complex lookup than a file lookup. I might do something like this:

egrep -ri [pattern] * | sed -e 's:\:.*::g' | grep -v ^Binary | sort | uniq | xargs vim

In my work (10 year old fast moving codebase), this kind of search is so common that I have the first five commands in a single shell script that I pipe to vim.

share|improve this answer
Couldn't you do vim $(callToBashScript)? – Niels Bom Aug 7 '12 at 14:44
Vim: Warning: Input is not from a terminal

A pipe is not a terminal as such, but have you tried fg?

share|improve this answer
fg what? there is no background job here – unbeli Jun 18 '10 at 10:01
Tried the exact same line in my terminal and got a running Vim process accesible via fg. – matiasf Jun 18 '10 at 10:10
Matias, can you please share your command? I haven't heard of fg before. How can I use it? – Anonymous Jun 18 '10 at 10:23
"fg" means foreground, swapping a paused process from background to foreground in your terminal. Try "man bash", then pause it by Ctrl-Z. Then issue "fg". – matiasf Jun 18 '10 at 11:04
It isn't running in the background, its standard input is attached to the pipe from locate, thus "Input is not from a terminal" is accurate. – msw Jun 18 '10 at 12:20

You must log in to answer this question.

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