rakitzis / rc

rc shell -- independent re-implementation for Unix of the Plan 9 shell (from circa 1992)
Other
250 stars 23 forks source link

VIM=nvim breaks both vim and neovim #97

Closed MaxGyver83 closed 3 months ago

MaxGyver83 commented 3 months ago

I have these lines in my .rcrc (for usage in aliases/functions):

if (whatis nvim >[1=] >[2=]) {
    VIM=nvim
} else VIM=vim

This breaks vim, nvim and $VIM.

When I start vim, I get:

Error detected while processing /home/max/.vimrc:
line    9:
E484: Can't open file nvim/syntax/syntax.vim
failed to load colors/lists/default.vim
...

When I start nvim, I get:

line 1393:
E919: Directory not found in 'packpath': "pack/*/opt/termdebug"
Error detected while processing /home/max/.config/nvim/init.vim[10]..function plug#end:
line   86:
E484: Can't open file nvim/syntax/syntax.vim
Error detected while processing /home/max/.config/nvim/init.vim:
...

Any ideas why this happens? Of course, I can remove these lines in my .rcrc but I want to understand this issue because otherwise I never know what's safe to do.

oliwer commented 3 months ago

Hi,

First of all, $VIM is an environment variable with special significance to vim. You can learn more about it by typing :help $VIM from vim.

Also, some plugins do not work well with rc due to its handling of double-quotes. I recently sent a patch to the vim-perl plugin to make it use single-quotes by default, which fixed things. Notice the use of shellxquote, which is Vim's special variable to decide which type of quotes to use (also available via the :help command).

MaxGyver83 commented 3 months ago

First of all, $VIM is an environment variable with special significance to vim. You can learn more about it by typing :help $VIM from vim.

Thank you! I didn't know this and the error message didn't point me there. I even didn't think this could matter because I set VIM in bash and fish as well. The difference/problem is that rc exports all variables automatically.

Also, some plugins do not work well with rc due to its handling of double-quotes. I recently sent a patch to the vim-perl plugin to make it use single-quotes by default, which fixed things. Notice the use of shellxquote, which is Vim's special variable to decide which type of quotes to use (also available via the :help command).

Thank you for this hint! If I understand correctly, this only matters when I use rc inside vim (set shell=/usr/local/bin/rc)!?

oliwer commented 3 months ago

If I understand correctly, this only matters when I use rc inside vim (set shell=/usr/local/bin/rc)!?

Indeed, of if, like me, you set SHELL=/bin/rc in your environment. Vim will pick it up.