VIM Disable Automatic Newline At End Of File

2020-01-24 01:53发布

So I work in a PHP shop, and we all use different editors, and we all have to work on windows. I use vim, and everyone in the shop keeps complaining that whenever I edit a file there is a newline at the bottom. I've searched around and found that this is a documented behavior of vi & vim... but I was wondering if there was some way to disable this feature. (It wouldbe best if I could disable it for specific file extensions).

If anyone knows about this, that would be great!

13条回答
甜甜的少女心
2楼-- · 2020-01-24 02:37

Maybe you could look at why they are complaining. If a php file has a newline after the ending ?>, php will output it as part of the page. This is not a problem unless you try to send headers after the file is included.

However, the ?> at the end of a php file is optional. No ending ?>, no problem with a newline at the end of the file.

查看更多
登录 后发表回答