You are not logged in.

#1 2019-08-19 15:17:09

Kolo
Member
Registered: 2018-10-28
Posts: 8

Vim doesn't look recursively for plugins??

I installed a plugin (vim-jedi) using pacman in the standard way (pacman -S vim-jedi) as root.
The relevant files all went to /usr/share/vim/vimfiles/ (checked using pacman -Q -l) and the plugin works fine when using vim as root, which is odd - why not in the $VIMRUNTIME directory?
However, the plugin doesn't load when running vim as a regular user. Checking the runtimepath, the /usr/share/vim/vimfiles/ directory was not included, so I tried including it in my vimrc, to no luck.
I've checked the global /etc/vimrc, the archlinux.vim, default.vim, root's ~/.vimrc and none of these mention /usr/share/vim/vimfiles/ and in addition $VIMRUNTIME is /usr/share/vim/vim81 (and changing it only creates more problems).

Ideally I want the plugin to work for all users and still have it handled by pacman. (and yeah, it's most probably me being stupid, not pacman's fault)

edit: title. Pacman is not the problem.

Last edited by Kolo (2019-08-22 16:29:58)

Offline

#2 2019-08-21 20:11:44

gmelodie
Member
Registered: 2019-08-17
Posts: 5

Re: Vim doesn't look recursively for plugins??

Just out of curiosity, are you logged in as root, something like:

$ sudo su
// type password 
# pacman -S vim-jedi 

Or are you using sudo while logged in as your normal user?

$ sudo pacman -S vim-jedi

You should not be trying to install things that you intend to be available to other users while logged in as root (first scenario) because then you'd be using the environment variables of the root user, instead of using sudo while logged in as your normal user (second scenario), which would use that user's environment variables to set up the plugins.

Offline

#3 2019-08-21 20:16:49

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Vim doesn't look recursively for plugins??

gmelodie wrote:

You should not be trying to install things that you intend to be available to other users while logged in as root (first scenario) because then you'd be using the environment variables of the root user, instead of using sudo while logged in as your normal user (second scenario), which would use that user's environment variables to set up the plugins.

None of this is true.

It is irrelevant which user you use to run pacman with sudo, exactly the same files are installed. And because pacman never touches any home directories the environment variables don't come into it.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2019-08-21 20:34:09

gmelodie
Member
Registered: 2019-08-17
Posts: 5

Re: Vim doesn't look recursively for plugins??

Slithery wrote:
gmelodie wrote:

You should not be trying to install things that you intend to be available to other users while logged in as root (first scenario) because then you'd be using the environment variables of the root user, instead of using sudo while logged in as your normal user (second scenario), which would use that user's environment variables to set up the plugins.

None of this is true.

It is irrelevant which user you use to run pacman with sudo, exactly the same files are installed. And because pacman never touches any home directories the environment variables don't come into it.


Could you explain more about why what I said is false? Why doesn't the problem have anything to do with environment variables? Also, I just tested this:

 
export BLABLA=asdf
$ echo $BLABLA
asdf

$ sudo echo $BLABLA
[sudo] password for user: 
asdf

$ sudo su
# echo $BLABLA
// nothing (empty)

Doesn't pacman use VIMRUNTIME to find the path for plugin files?

Offline

#5 2019-08-21 20:45:34

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Vim doesn't look recursively for plugins??

Doesn't pacman use VIMRUNTIME to find the path for plugin files?

No, because that's nuts and also completely irrelevant to your point - which is wrong.

Your sudo test is bogus, the variable is interperted in the current shell, not in the sudo one.

sudo env | grep BLABLA
sudo -E env | grep BLABLA # only this one should have the variable

Offline

#6 2019-08-21 20:52:15

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Vim doesn't look recursively for plugins??

Kolo wrote:

in addition $VIMRUNTIME is /usr/share/vim/vim81 (and changing it only creates more problems).

Why is it that value and how does changing it create what "more problems"??

/usr/share/vim/vim81 is supposed to be part of the default runtimepath (after ~/.vim & /usr/share/vim/vimfiles)

edit: typo

Last edited by seth (2019-08-21 20:56:05)

Offline

#7 2019-08-21 20:54:48

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: Vim doesn't look recursively for plugins??

What is the output of :scriptnames as both root and the normal user?
Also is $VIMRUNTIME set for those users?

Offline

#8 2019-08-22 00:07:52

Kolo
Member
Registered: 2018-10-28
Posts: 8

Re: Vim doesn't look recursively for plugins??

seth wrote:
Kolo wrote:

in addition $VIMRUNTIME is /usr/share/vim/vim81 (and changing it only creates more problems).

Why is it that value and how does changing it create what "more problems"??

/usr/share/vim/vim81 is supposed to be part of the default runtimepath (after ~/.vim & /usr/share/vim/vimfiles)

edit: typo

Inside vim, running :echo $VIMRUNTIME as any user I get /usr/share/vim/vim81 and trying to change that to anything messes up any scripts that refer to $VIMRUNTIME.

@loqs the only difference was the missing plugin. First few lines are:

  1: /etc/vimrc                                                                             
  2: /usr/share/vim/vimfiles/archlinux.vim
  3: ~/.config/vim/vimrc
  4: /usr/share/vim/vim81/defaults.vim

All other files are in a  /usr/share/vim/vim81 - keep that in mind.

Also, here's the result of running :set runtimepath? as root:

runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim81,/usr/share/vim/vim81/pack/dist/opt/matchit,/usr/share/vim/vimfiles/after,~/.vim/after

I narrowed down the problem to a few lines in my vimrc by changing it to the default:

set directory=$XDG_CACHE_HOME/vim,/tmp
set backupdir=$XDG_CACHE_HOME/vim,/tmp
set viminfo+=n$XDG_CACHE_HOME/viminfo  
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$VIM

(I added this in accordance to this guide https://tlvince.com/vim-respect-xdg as I didn't want vim to vomit all it's viminfo files into up my ~/ directory.)

Now :echo $VIM gives /usr/share/vim/ as any user. However, changing the last line to:

set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,/usr/share/vim/vimfiles,/usr/share/vim/vimfiles/after,/usr/share/vim/vim81/pack/dist/opt/matchit

I interpreted that as implying that there's a runtime directory outside of $XDG_CONFIG_HOME/vim,$VIM,$VIMRUNTIME even though as mentioned previously both :scriptnames and :set runtimepath? only return scripts located somewhere in $VIM that is /usr/share/vim/ (excluding the global /etc/vimrc which will load regardless of any settings). Matchit also stops working without that last long string above referring to its directory specifically.
I thought the plugin should been fine loading because it's already inside $VIM - does the path have to be further specified? If so, which file sets the new runtimepath whenever a plugin (like Matchit for example) is installed?

edit: code tags
edit2: I'll mark this down as solved soon if no one has any ideas regarding these broader questions

Last edited by Kolo (2019-08-22 00:10:54)

Offline

#9 2019-08-22 00:12:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: Vim doesn't look recursively for plugins??

I'm sorry I can't contribute more as I'm a bit lost in all the user settings and enviornment variables you are using.  I would, however, suggest simplying your configs as much as practical.

But you've gone down the wrong path in searching for the problem: the plugin you want to use seems to work as root and not as your user and you inferred that this is due to pacman installing it wrong.  This is a faulty inference.  Instead, some of the configs or environment variable settings you have for your user are preventing the plugin(s) from loading or working properly.

Note that VIMRUNTIME need not be set at all for vim and plugins to work properly.

Last edited by Trilby (2019-08-22 00:13:05)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#10 2019-08-22 05:48:07

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Vim doesn't look recursively for plugins??

Inside vim, running :echo $VIMRUNTIME as any user I get /usr/share/vim/vim81 and trying to change that to anything messes up any scripts that refer to $VIMRUNTIME.

wowowow… wait: the variable inside vim does not strictly relate to the variable in your shell (which is the only thing pacman could care about at best)


Anyway, what you "actually wanted to do"™ is

set runtimepath+=/usr/share/vim/vim81/pack/dist/opt/matchit

though I'm pretty sceptic that this is required at all, because matchit is part of vim-runtime and to be found as long as /usr/share/vim/vim81 is in the runtimepath (as is by default) because it's searched recursively (and that's the path for all distro packages)

I suggest you post your vimrc and also elaborate on how you determine that matchit "doesn't work"™

Offline

#11 2019-08-22 16:28:57

Kolo
Member
Registered: 2018-10-28
Posts: 8

Re: Vim doesn't look recursively for plugins??

@Trilby - yeah, I thought it was a problem with pacman at first. It would make more sense to me if it installed the plugin in the /usr/share/vim/vim81 directory as opposed to /usr/share/vim/vimfiles but I guess that's just how it's designed, for good reasons probably.

@Seth

seth wrote:

Inside vim, running :echo $VIMRUNTIME as any user I get /usr/share/vim/vim81 and trying to change that to anything messes up any scripts that refer to $VIMRUNTIME.

wowowow… wait: the variable inside vim does not strictly relate to the variable in your shell (which is the only thing pacman could care about at best)

$VIMRUNTIME is not defined in my shell. Again, I've come to realise the problem isn't with pacman, I suppose I should change the thread title now. 

though I'm pretty sceptic that this is required at all, because matchit is part of vim-runtime and to be found as long as /usr/share/vim/vim81 is in the runtimepath (as is by default) because it's searched recursively (and that's the path for all distro packages)

That's exactly my problem. It's supposed, or at least I'd expect it, to search recursively but it doesn't. That is with:

set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,/usr/share/vim/vimfiles,/usr/share/vim/vimfiles/after,/usr/share/vim/vim81/pack/dist/opt/matchit

running :scriptnames includes a line that shows matchit is working.

But when I comment it out:

set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,/usr/share/vim/vimfiles,/usr/share/vim/vimfiles/after ",/usr/share/vim/vim81/pack/dist/opt/matchit

And even when give substitute /usr/share/vim/vim81 explicitly:

set runtimepath=$XDG_CONFIG_HOME/vim,/usr/share/vim/vim81,/usr/share/vim/vimfiles,/usr/share/vim/vimfiles/after ",/usr/share/vim/vim81/pack/dist/opt/matchit

running :scriptnames doesn't include anything related to matchit.

I seriously doubt there's anything else in my vimrc related to this as none of the other settings concern runtime.

Offline

#12 2019-08-22 19:35:21

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Vim doesn't look recursively for plugins??

packadd matchit

The main plugin functions actually only seem to deal w/ "plugin/**/*.vim" inside the runtimepath, no idea about why there're different distribution patterns or access methods.

Offline

Board footer

Powered by FluxBB