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

Running Vim in Neovim's terminal load Nvim #9960

Closed
JulioJu opened this issue May 1, 2019 · 11 comments
Closed

Running Vim in Neovim's terminal load Nvim #9960

JulioJu opened this issue May 1, 2019 · 11 comments
Labels
closed:duplicate issues that are closed as duplicates of other issues environment user system environment (terminal, shell, tmux) terminal built-in :terminal or :shell

Comments

@JulioJu
Copy link

JulioJu commented May 1, 2019

  • nvim --version: from 0.3.2 to current release version (0.3.5). Didn't exist in neovim 0.3.1.
    vim --version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 26 2019 21:55:55)
    Included patches: 1-1186 (https://www.archlinux.org/packages/extra/x86_64/gvim/)
  • Operating system/version: Arch Linux
  • Terminal name/version: urxvt
  • $TERM: xterm-256color

Steps to reproduce 1

File ~/test.vim

set nocompatible
filetype plugin indent on
syntax on
nvim -u NONE +term
vim ~/test.vim
Actual behaviour

Display

Error detected while processing function <SNR>14_LoadRemotePlugins[1]..<SNR>14_GetManifest[1]..<SNR>14_GetManifestPath:
line    7:
E117: Unknown function: stdpath
Press ENTER or type command to continue
Expected behaviour

The previous error message should not be appear. It doesn't appear with neovim 0.3.1

Step to reproduce 2

# Assume there isn't file `~/ejiooijeijfe`
rm -f ~/ejiooijeijfe
nvim -u NONE +term
vim -u ~/ejiooijeijfe
Actual behaviour
E282: Cannot read from "/home/julioprayer/ejiooijeijfe"
Error detected while processing /usr/share/nvim/runtime/plugin/man.vim:
line    9:
E10: \ should be followed by /, ? or &
line   10:
E10: \ should be followed by /, ? or &
Error detected while processing function <SNR>7_LoadRemotePlugins[1]..<SNR>7_GetManifest[1]..<SNR>7_GetManifestPath:
line    7:
E117: Unknown function: stdpath
(…)
Expected behaviour

The line two with Error detected while processing /usr/share/nvim/runtime/plugin/man.vim: should not be displayed. with Neovim Terminal 0.3.1, this line isn't displayed. Why when we open Vim under a Neovim Terminal 0.3.2 -> 0.3.5 /usr/share/nvim/runtime/plugin/man.vim is read ? Messages described in section above should not be displayed too, as in neovim 0.3.1.

@JulioJu
Copy link
Author

JulioJu commented May 1, 2019

I am going to bissect

@justinmk
Copy link
Member

justinmk commented May 1, 2019

Bisect not necessary. This is simply due to the fact that $VIMRUNTIME is set to Neovim's runtime. Unset it before running vim in :terminal.

:te
VIMRUNTIME= vim

It's planned for :terminal to unset $VIMRUNTIME by default. Covered by existing issues/PRs.

@justinmk justinmk closed this as completed May 1, 2019
@justinmk justinmk added environment user system environment (terminal, shell, tmux) terminal built-in :terminal or :shell labels May 1, 2019
@JulioJu
Copy link
Author

JulioJu commented May 1, 2019

@justinmk ok thanks :-)


If an other user have this problem and read the current issue I use the following workaround:

I've added the following in $HOME/.zshrc and $HOME/.bashrc

# Test if the shell is launched in Neovim's Terminal
if [[ -n "${NVIM_LISTEN_ADDRESS}" ]]
then
    # TODO update the path each time Vim has a major upgrade
    export VIMRUNTIME=/usr/share/vim/vim81
fi

@jamessan
Copy link
Member

jamessan commented May 2, 2019

@JulioJu Better would be to simply unset VIMRUNTIME instead of setting it to a value that will eventually be wrong. Vim knows how to figure out what VIMRUNTIME should be if it's not already set in the environment.

@JulioJu
Copy link
Author

JulioJu commented May 2, 2019

@jamessan thanks for your answer.

I've already tested unset VIMRUNTIME, but doesn't work. When I open Vim, I experience the same problem described in the first comment (before open vim I test than VIMRUNTIME is well unsetted thanks the test$ if [[ -z $VIMRUNTIME ]] ; then echo 'This variable is not defined' ; fi

The only solution than I've found is #9960 (comment)

I don't know why. So strange.

@x-yuri
Copy link

x-yuri commented Jan 6, 2020

@JulioJu You must be doing something wrong (VIMRUNTIME doesn't get unset? typing error? zsh specific?) unset VIMRUNTIME or VIMRUNTIME= handle it for me.

@tmbdev
Copy link

tmbdev commented Apr 14, 2020

I'm having the same problem: "stdpath" is simply not defined. It's hard to understand why a standard function like this would be defined under some circumstances and not under others, in my case, at the beginning of init.vim. No way to debug it. Very frustrating. Have to switch back to vim, which doesn't have this problem.

@x-yuri
Copy link

x-yuri commented Apr 14, 2020

@tmbdev When you run nvim, then create a terminal buffer (:te), nvim doesn't unset the VIMRUNTIME environment variable. When you later start vim it receives the nvim's value (VIMRUNTIME=/usr/share/nvim/runtime). In other words that makes vim use nvim's plugins, color themes, documentation and all. vim doesn't have the stdpath() function (as opposed to nvim), so when vim gets to executing /usr/share/nvim/runtime/plugin/rplugin.vim it stumbles on the stdpath() line. Because vim is not supposed use nvim's plugins.

A way to reproduce it from the shell (not from nvim):

VIMRUNTIME=/usr/share/nvim/runtime vim

It's planned to make :te unset VIMRUNTIME, which will resolve the issue. Meanwhile, you can do that by hand before running vim from nvim (unset VIMRUNTIME).

@chrissound
Copy link

chrissound commented Dec 15, 2021

It's planned for :terminal to unset $VIMRUNTIME by default. Covered by existing issues/PRs.

Seems this issue is still present (tested on v0.5.1). Should this issue be reopened? @justinmk

@clason
Copy link
Member

clason commented Dec 15, 2021

No, as it's still a duplicate of #6764 and #8696.

@clason clason added the closed:duplicate issues that are closed as duplicates of other issues label Dec 15, 2021
@n1tch3
Copy link

n1tch3 commented Feb 5, 2022

@jamessan thanks for your answer.

I've already tested unset VIMRUNTIME, but doesn't work. When I open Vim, I experience the same problem described in the first comment (before open vim I test than VIMRUNTIME is well unsetted thanks the test$ if [[ -z $VIMRUNTIME ]] ; then echo 'This variable is not defined' ; fi

The only solution than I've found is #9960 (comment)

I don't know why. So strange.

I needed to unset VIM also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:duplicate issues that are closed as duplicates of other issues environment user system environment (terminal, shell, tmux) terminal built-in :terminal or :shell
Projects
None yet
Development

No branches or pull requests

8 participants