Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The one place where this really bites me is return statements. For example:

    function x() {
       return 
    	   2+3;
    }
    alert(x());
Every now and then I'll reformat a line by breaking it in two and it takes me 10 minutes to figure out why my code is not working.


damn it I forgot that - does anyone know how to make vim highlight this?


In your after/syntax/javascript.vim:

    syntax match javascriptReturnError /return\s*\n\r\?\s*\w.*$/

    ...

    highlight link javascriptReturnError Error
Obviously you can play around with the regex to tweak what matches.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: