zoukankan      html  css  js  c++  java
  • 记一次安装zsh插件编码^M异常操作

    安装插件异常

    ❯ source ~/.zshrc
    /root/.zinit/bin/zinit.zsh:3: command not found: ^M
    /root/.zinit/bin/zinit.zsh:7: command not found: ^M
    /root/.zinit/bin/zinit.zsh:typeset:8: not valid in this context: ZINIT_RUN^M
    /root/.zshrc:168: command not found: zinit
    

    搞了好久,都不知道什么原因造成的

    但是肯定不是插件问题,因为我在另外一台电脑安装成功了。

    查看具体文件的编码

    ❯ file ~/.zinit/bin/zinit.zsh
    /root/.zinit/bin/zinit.zsh: UTF-8 Unicode text, with very long lines, with crlf line terminators
                                                                        �  � with root@hongda � at 18:10:02 
    ❯ file ~/.zshrc
    /root/.zshrc: UTF-8 Unicode text
    

    查看编码也是utf-8的,但是带上crlf

    通过od命令转换8进制字码

    文件转换成8进制字码呈现出来

    这里的换行符为

    这个时候就想应该是通过git下载插件的时候换行符自动转换造成的。

    修改git的换行符设置

    ❯ git config --list |grep autocrlf
    core.autocrlf=true
    

    禁用自动转换

    git config core.autocrlf false
    git config --global core.autocrlf false
    

    再次通过git下载插件,查看字码

    可以看见只有 的换行符

    执行source命令也ok

  • 相关阅读:
    Windows7共享设置
    13-运算符
    13-数据类型转换
    06-移动web之flex布局
    09-sass
    08-less预处理器
    移动端必须掌握知识点
    11-JS变量
    10-响应式
    07-rem
  • 原文地址:https://www.cnblogs.com/hongdada/p/14043871.html
Copyright © 2011-2022 走看看