zoukankan      html  css  js  c++  java
  • 如何让Vim显示dos下的^M符号

    /***********************************************************************
     *                  如何让Vim显示dos下的^M符号
     * 声明:
     *     我们都知道unix下的文本文件和Dos下的文本文件是有差异的,但是在使用
     * GVim和Ubuntu下的Vim的时候,他们经常不显示这种差异,有些人是在Windows
     * 下写shell脚本给你,然后你很蛋疼的拿到嵌入式Linux产品上去跑,一个劲的
     * 不知道为什么总是不正确,尤其当重定向到/dev/null。
     *
     *                                      2016-1-8 深圳 南山平山村 曾剑锋
     **********************************************************************/
    
    一、参考文档:
        1. how to make vim show ^M and substitute it
            http://stackoverflow.com/questions/3852868/how-to-make-vim-show-m-and-substitute-it
        2. Linux中dos2unix的批量转换命令
            http://liuleijsjx.iteye.com/blog/859389
    
    二、确认文本文件格式方法:
        1. $ file test_data             ----->    (dos)
            test_data: POSIX shell script, ASCII text executable, with CRLF line terminators
        2. $ file test_data             ----->    (unix)
            test_data: POSIX shell script, ASCII text executable
        
    三、解决方法:
        1. 查看方法:
            vim中键入:
                :e ++ff=unix
        2. 去除^M的Linux shell批处理:
            find -type f | xargs dos2unix -o
  • 相关阅读:
    DC中为什么要用Uniquify?
    hdu 1596 find the safest road
    hdu2112 HDU Today
    hdu 2066 一个人的旅行
    poj 3026 Borg Maze
    poj 1979 Red and Black
    poj 1321 棋盘问题
    hdu 1010 Tempter of the Bone
    hdu 4861 Couple doubi
    codeforces584B Kolya and Tanya
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/5113419.html
Copyright © 2011-2022 走看看