14

I want to set QtCreator to use CRLF instead of LF in unix. Is there a way to do that?

PS: I know I can use dos2unix on the files however I don't want to do that.

Dan Lincan
  • 1,065
  • 2
  • 14
  • 32
  • This is typically done through the version control system so that files can be shared across different platforms. Is there a different reason you want the CRLF on Linux besides portability across platforms? – Dave Mateer Mar 27 '12 at 20:13
  • That's exactly why, but I want to avoid using dos2unix anytime I use diff on some windows sources that qt creator modified. – Dan Lincan Mar 27 '12 at 20:56
  • What version control system are you using? All of the diff tools I use (with Subversion) automatically ignore line-ending-only differences. – Dave Mateer Mar 27 '12 at 21:02
  • By default VCS try to use local EOL, but e.g. in git, u can override defaults - good [starting point could be](https://help.github.com/articles/dealing-with-line-endings/), but be careful! – Ľubomír Carik Apr 24 '18 at 23:11

3 Answers3

2

The next QtCreator version will have the possibility to change the line endings for an open document from the toolbar.

Depending on the time I'll try to also try to make a default option into QtCreator settings for newly created files.

smaryus
  • 349
  • 3
  • 12
1

It is bug in QtCreator - https://bugreports.qt.io/browse/QTCREATORBUG-3590 May be some one reopen it again.

leanid.chaika
  • 2,143
  • 2
  • 27
  • 30
0

Some possibilities: 1. I notice once QtCreator opens a CRLF file in Linux, it treats it like a CRLF file, so you'd only have to run dos2unix once on the file. 2. 'diff --strip-trailing-cr ...' works. 3. As mentioned in the comments, most version control systems can be set to do local or fixed line endings, so you may chase the problem in your VCS tool instead of Creator.

I tried out various encodings under Tools->Options->Editor, but none seem to affect the line ending (and I'm surprised Creator doesn't seem to have a setting for this--but option 4 is you can always get Creator's source code...)

Scott
  • 1,179
  • 7
  • 17