简体   繁体   English

鱼壳采购nvim配置抛出错误

[英]sourcing nvim config throwing error with fish shell

I recently switched to fish shell from zsh and I have been encountering errors when I update my nvim config file 我最近从zsh切换到fish shell,并且在更新nvim配置文件时遇到错误

It appears the error comes when checking for the $TMUX environmet variable in a conditional statement. 在条件语句中检查$TMUX environmet变量时,似乎出现错误。 I added set shell=/bin/bash to the config solve the problem reloading vim but the error persisted. 我在配置中添加了set shell=/bin/bash来解决重新加载vim的问题,但是错误仍然存​​在。

Here is the error from when I try source ~/.config/nvim/init.vim : 这是我尝试使用source ~/.config/nvim/init.vim时出现的错误:

~/.config/nvim/init.vim (line 99): Illegal command name “exists("$TMUX")”
if exists("$TMUX")
   ^
from sourcing file ~/.config/nvim/init.vim
    called on line 1 of file -

in function “sv”
    called on standard input

source: Error while reading file “/home/slick/.config/nvim/init.vim”

Confused because I am not very solid with vimscript and am not sure which language the conditional statement in the nvim config should be written in or how to resolve this error. 感到困惑是因为我对vimscript不太了解,并且不确定nvim配置中的条件语句应使用哪种语言编写,或者不确定如何解决此错误。

source ~/.config/nvim/init.vim

is a Neovim command, not a shell command. 是Neovim命令,而不是Shell命令。 There's no reason whatsoever to expect your shell to understand Neovim's scripting language so running that command in your shell makes no sense at all . 有没有任何理由期待你的shell明白这样运行在你的shell命令没有任何意义可言 Neovim的脚本语言。

Run it in Neovim, not in your shell. 在Neovim中运行它,而不是在您的Shell中运行。

Vim scripts that run external commands expect a POSIX compatible shell. 运行外部命令的Vim脚本需要POSIX兼容的shell。 Fish is explicitly not POSIX compatible. Fish明显不兼容POSIX。 Add set shell=/bin/sh (or some other POSIX shell) to your vimrc. set shell=/bin/sh (或其他POSIX shell)添加到您的vimrc中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM