skywind3000 / z.lua

:zap: A new cd command that helps you navigate faster by learning your habits.
MIT License
2.98k stars 140 forks source link

(eval):76: parse error near `/f' #171

Closed vipzrx closed 2 years ago

vipzrx commented 2 years ago

msys2下 安装

~ ❯ git clone https://github.com/skywind3000/z.lua.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/z.lua

安装lua5.4

~ ❯ pacman -S mingw-w64-x86_64-lua
warning: mingw-w64-x86_64-lua-5.4.4-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) mingw-w64-x86_64-lua-5.4.4-1

Total Installed Size:  1.42 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n]

在.zshrc中添加

eval "$(lua $HOME/.oh-my-zsh/custom/plugins/z.lua/z.lua --init zsh)"

执行 source .zshrc

报错 ~ 20s ❯ source .zshrc (eval):76: parse error near `/f'

skywind3000 commented 2 years ago

你分不清 msys 和 mingw 的区别么,你想在 msys 环境下用 z.lua ,就该用 msys 的 lua 而不是 mingw 的 lua, mingw 的软件包都是标准 windows 程序,根本不认识你的 msys2 环境 你可以用 msys2 里的 gcc 编译一个 lua 源代码,得到 msys2 的 lua。

再说一遍,mingw 的 lua 完全不认识 msys2 环境,还以为自己在标准 windows 命令行下运行呢,那么 z.lua 一样不认识,按照 windows 的 batch 文件输出了初始化代码,自然你的 zsh 无法解析,只有 msys2 的 lua 才认识该环境。

vipzrx commented 2 years ago

感谢回复。我在研究下

wget https://media.githubusercontent.com/media/zeromake/msys2-packages/master/luajit-2.1.0-1-x86_64.pkg.tar.zst wget https://media.githubusercontent.com/media/zeromake/msys2-packages/master/lua-5.4.3-1-x86_64.pkg.tar.zst

pacman -U lua-5.4.3-1-x86_64.pkg.tar.zst

pacman -U luajit-2.1.0-1-x86_64.pkg.tar.zst