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 run :!node app.js from inside Vim and after hitting ctrl-c to end it, the bottom half of the window is blank. Even hitting ctrl-L to refresh doesn't work.

This has happened on both OSX 10.6 and 10.7, and with the default OSX vim as well as the latest stable version which I compiled (vim 7.3). And I've tried it with iterm, iterm2, and terminal.app.

Probably not Node related, but if I run a command like "!ls" or "!cat %" (to echo current file), they work fine.

share|improve this question

migrated from stackoverflow.com Sep 10 '11 at 7:46

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

    
Did you check if Ctrl-l has been remapped? Also, does running it in the background have the same problem: !node app.js & Or you could use vim on a real computer instead of on iOS ;) –  idbrii Sep 10 '11 at 6:38
    
Ctrl-l is definitely working, but it doesn't refresh the part that's already vanished. Running the node process in the background or even redirecting to /dev/null doesn't have any effect. –  mahemoff Sep 10 '11 at 8:09
    
So just running node in the background corrupts your screen even if all output is redirected (stdout and stderr)? That sounds seriously crazy. Maybe a screenshot would help? What if you use set makeprg=node and :make app.js? –  idbrii Sep 10 '11 at 16:36
    
I know, it's crazy. Better than a screenshot, here's a screencast. media.shinywhitebox.com/michael-mahemoff/vim-unrefresh Running "coffee %" wipes out the bottom third of the screen, even after hitting ctrl-l. Only "v" selection brings it back, but in a really awkward way. (First upload with iShowU, sorry it comes out so small, but I think the point is made.) –  mahemoff Sep 11 '11 at 13:45

1 Answer 1

You should probably use :make. (Note: that doesn't mean you need a makefile.)

Vim's make is setup to ensure all output is redirected so control sequences (like setting font color) don't mess up vim. (You can see the options make uses to do when it runs.)

You'll first have to set your make program to your interpreter instead of make.

set makeprg=node
make app.js

You should get output in your quickfix window (:copen). You might want to find the correct errorformat for Javascript/Coffee so it parses errors properly. Here's a pretty complete-looking vim-coffee plugin.

share|improve this answer
    
Thanks for the suggestion. I have no idea what's up, but unfortunately it was the same result as before. makeprg did its job and the server ran, but garbaged screen again. –  mahemoff Sep 11 '11 at 21:26

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.