Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse errors due to ^M end of line #4870

Closed
sinlov opened this issue Feb 23, 2016 · 9 comments
Closed

Parse errors due to ^M end of line #4870

sinlov opened this issue Feb 23, 2016 · 9 comments

Comments

@sinlov
Copy link

sinlov commented Feb 23, 2016

.zshrc:3: command not found: ^M
.oh-my-zsh/oh-my-zsh.sh:42: parse error near `||'

38 is_plugin() {
39   local base_dir=$1
40   local name=$2
41   test -f $base_dir/plugins/$name/$name.plugin.zsh \
42     || test -f $base_dir/plugins/$name/_$name
43 }

All files change to windows file style: each file endline is ^M.

zsh 5.2 (x86_64-apple-darwin14.5.0)

@mcornella mcornella changed the title All the code change to Windows Style Parse errors due to ^M end of line Feb 23, 2016
@mcornella
Copy link
Member

The temporary solution to that is changing your core.autocrlf git config setting to use input, given that you are on OSX. See #4402 (comment).

To sum up, you need to run the following:

cd $ZSH
git config core.autocrlf input
git rm --cached -r .
git reset --hard

@sinlov
Copy link
Author

sinlov commented Feb 23, 2016

thinks ~

I'm setting
git config --global core.autocrlf true
so that。。

@mcornella
Copy link
Member

Don't set it to true, set it to input. That's a better default for OSX.

@sinlov
Copy link
Author

sinlov commented Feb 23, 2016

Thanks For Sharing~

@teamonn
Copy link

teamonn commented Mar 31, 2017

  1. .zshrc:3: command not found: ^M The solution is as follows:

vim ~/.zshrc then enter :set ff=unix

  1. .oh-my-zsh/oh-my-zsh.sh:42: parse error near `||' The solution is as follows:
cd $ZSH
git config core.autocrlf input
git rm --cached -r .
git reset --hard

Who can explain the reason, I will be grateful. Most of them appear on the OSX system.

@nickwebcouk
Copy link

nickwebcouk commented Sep 2, 2020

I'm still having this issue after following the troubleshooting steps above.

Last login: Mon Aug 24 09:52:54 on ttys000
/Users/nick/.oh-my-zsh/oh-my-zsh.sh:20: parse error near `<<<'

sw_vers:
ProductName:	Mac OS X
ProductVersion:	10.15.6
BuildVersion:	19G73

uname -a
Darwin Mac-mini.local 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul  5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64

Can this be reopened? Thanks, Nick

@mcornella
Copy link
Member

You must not have the latest OMZ update, there's no <<< in the oh-my-zsh.sh file at the moment. Try omz update.

@nickwebcouk
Copy link

Looks like I've hijacked this unnecessarily - manually went and edit the file and removed all non confirming characters, but now all I get is a '''[oh-my-zsh] plugin 'git,zsh-autosuggestions' not found'''. Shall I raise a fresh issue? Thanks,

@mcornella
Copy link
Member

Oh you probably had a git conflict pending to resolve, that's probably the source of the <<< characters.

Re: the not found error, the plugins variable is an array, and in zsh array entries are separated by whitespace, not commas. So that's why you see that error, OMZ is looking for a plugin literally named git,zsh-autosuggestions. Plus, make sure to have zsh-autosuggestions installed as an OMZ plugin, otherwise you'll get another not found error for that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants