Beginner's tool use (eight)--egit Disable auto-convert carriage return line break

Source: Internet
Author: User

It is well known that Windows and Linux systems have a different carriage return. To learn more about them, you can read the following introduction, not interested can skip directly.

Create a background

The origins and differences between the two concepts of "carriage return" (carriage return) and "line feed". Before the computer appeared, there was a gadget called a telex typewriter (teletype Model 33) that could play 10 characters per second. But it has a problem, that is, when the line is finished, it will take 0.2 seconds to hit two characters. If there are new characters coming in this 0.2 seconds, then this character will be lost.

So, the developers think of a way to solve this problem, is to add two after each line to end the character. One is called "carriage return", which tells the typewriter to position the printhead at the left border, and the other is called "line break", telling the typewriter to move the paper down one line.

Later, the computer invented, these two concepts are also like to the computer. At that time, memory was expensive, and some scientists thought it would be too wasteful to add two characters at the end of each line. So, there was a disagreement. Unix system, each line at the end of only "< line >", that is, "\ n", the Windows system, the end of each line is "< Enter >< line >", that is "\ r \ n", the Mac system, the end of each line is "< Enter >". A direct consequence of this is that if the file under the Unix/mac system is opened in Windows, all the text will be turned into one line, and if the files in Windows are opened under Unix/mac, a ^m symbol may appear at the end of each line.

Windows creates files that end in \n\r, while Unix-like Linux operating systems are \ n-end. So the UNIX text to Windows will appear newline lost (UltraEdit this kind of software can be recognized correctly), and in turn will appear ^m symbols

The text line breaks used by operating systems such as windows are different from those used by the Unix/linux operating system, and the line breaks entered under windows are not displayed as "wrap" under Unix/linux, but instead appear as ^m (this is a special tag specified under Linux and other systems. A character size, not a combination of ^ and M, printed out). Many text editors (command lines) under Linux will add a newline character after displaying this tag to avoid clutter (just for display, supplementary line breaks are not written to files, and special commands replace Windows newline characters with Linux line breaks). Line breaks under the Unix/linux system are ignored in the text editor of the Windows system, and the entire text is mess.

Body


Because of the above differences, there will be the next point of return to the issue of the conversion of carriage returns. Now a lot of companies are Windows development environment, Linux server, Git has a default automatically converted to return to line-up function, but this function is sometimes naughty, which will cause our code to have some inexplicable problems, so in order to solve this problem, We need to set the carriage return line of the development environment to UNIX style, and disable the automatic conversion function of Git. Let's take a look at how to set up:


First open the Eclipse's Properties panel, locate the team, then git, switch to the System Settings tab, and click Browse.



Choose the installation directory for Git (e.g. C:\Program Files (x86) \git)


Finally, set the Autocrlf property to False.



OK, so you don't have to worry about the problem of line break inconsistencies. It is so simple, come and try it!



Beginner's tool use (eight)--egit Disable auto-convert carriage return line break

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.