The bottom of the Vim editor [Noeol], [dos] meaning

Source: Internet
Author: User




the bottom of the Vim editor [Noeol], [dos] meaning



Sometimes using Vim to open a file will be found at the bottom of the window [Noeol], [DOS] hint information:


"Hello-dos.txt" [Noeol][dos] 2L, 10C 1,1 all


What does the two symbols mean?






Intuitively, ' noeol ' is ' no end-of-line ', which means ' no end of line ', and a text editor (such as Vim) under Linux adds a line break at the end of each line, including the last line. For example, we create a new text file named ' Hello-unix.txt ' under Debian, which reads as follows:


Hello Unix


Then, you can see these line breaks using the cat-a hello-unix.txt command:


ts@ts:~/www/document $ cat-a hello-unix.txt hello$ unix$ ts@ts:~/www/document $


You can clearly see the ' $ ' character at the end of each line, which is "end of line" under Linux.






Below, we will create a notepad file named ' Hello-dos.txt ' under Windows, which reads as follows:


Hello DOS


View line feed information for this file under Debian:


ts@ts:~/www/document $ cat-a hello-dos.txt hello^m$ dosts@ts:~/www/document $


Also two lines, one word per line, and two distinct differences between Windows and Linux for line breaks:



The line break under Windows is more than a ^m under Linux;



There are no line breaks at the end of the last line;



These two differences are also the reasons why [DOS], [noeol] two Flag information appears. The line breaks for each line of the text file in Windows are "carriage return + newline" (crlf,^m$), while Linux is only "line feed" (LF, $). Vim found that the text contains ^m$ newline character to determine the file created under Windows, with [DOS] Flag hint; vim does not find line breaks on the last line, determines that the file is not created/edited under Linux, and prompts the user with [Noeol] Flag.



How to eliminate [noeol] Flag information.

Simply save the file in Debian, or the Hello-dos.txt file above, open it without making any changes directly: Wq save exit, and then view line break:


ts@ts:~/www/document $ cat-a hello-dos.txt hello^m$ dos^m$ ts@ts:~/www/document $


The newline character has been appended up, note here that the Append is the line break (carriage return + newline) ^m$ under Windows instead of the line break (newline) $ in Linux, because Vim has found that this file was created under Windows ([DOS] Flag), although it is in Linu Under X Edit, Vim adds line breaks according to the line break rules under the operating system where the file was created.



How to Eliminate [dos] Flag information.






There are two simple ways to do this:



Linux provides two commands for converting Windows and Unix files: Dos2unix and Unix2dos;



Use Touch template.txt under Debian to create a template in which any text file created under Windows is based on this template;






Resources






Http://unix.stackexchange.com/questions/31807/what-does-the-noeol-indicator-at-the-bottom-of-a-vim-edit-session-mean



Http://linux.vbird.org/linux_basic/0310vi.php#tips_dos





Related Article

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.