简体   繁体   中英

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

It appears the error comes when checking for the $TMUX environmet variable in a conditional statement. I added set shell=/bin/bash to the config solve the problem reloading vim but the error persisted.

Here is the error from when I try 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.

source ~/.config/nvim/init.vim

is a Neovim command, not a shell command. 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 .

Run it in Neovim, not in your shell.

Vim scripts that run external commands expect a POSIX compatible shell. Fish is explicitly not POSIX compatible. Add set shell=/bin/sh (or some other POSIX shell) to your vimrc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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