在windows下,默认换行符是\r\n,所以新建的文本文件会出现\r。
修改默认Line Separators,File->Settings->Editor->Code Style,右侧的Line separator(for new files),选择Unix and OS X (\n)。
修改单个文件的时候,在File->Line Separators中选择就好了。
参考: https://www.jetbrains.com/help/idea/2016.1/configuring-line-separators.html?origin=old_help