4

I've installed syntastic VIM plugin by following instructions from the plugin docs via pathogen.

  1. Install pathogen:

    mkdir -p ~/.vim/autoload ~/.vim/bundle && \
    curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
    
  2. Install syntastic as pathogen bundle:

    cd ~/.vim/bundle &&
    git clone https://github.com/scrooloose/syntastic.git
    

At this point it's in my $HOME/.vim directory of my Linux user.

I'd like to install this plugin to be globally available for all users on the box, but I'm having trouble finding out how to go about doing it. All the instructions seem to talk about installing plugins under $HOME/.vim.

Hauleth
  • 22,873
  • 4
  • 61
  • 112
Pavel Chernikov
  • 2,186
  • 1
  • 20
  • 37

1 Answers1

3

Recommended

  • Before you start, update your vim to the last version. If using debian, install vim.nox (python support) and run update-alternatives for vim, vi and vimdiff.

How-to

Using vim-plug I've managed to create a global plugin installation.

This is a step-by-step explanation;

  1. create /etc/vim/autoload. Make sure others can read/execute the directory.
  2. add plug.vim file in it. Make sure all users can read it. See below: Download
  3. add to (preferred the begin of) your /etc/vim/vimrc.local

    set runtimepath+=/etc/vim/autoload
    " Initialize plugin system
    call plug#begin('/etc/vim/plugged')
    " Vimtemplates - templates for diverse files
    Plug 'drbeco/vimtemplates', { 'do': '/etc/vim/plugged/vppinstall.sh' }
    " VimColors8 - colorschemes for all
    Plug 'drbeco/vimcolors8', { 'do': '/etc/vim/plugged/vppinstall.sh' }
    call plug#end()
    " End of initialization of plugin system
    

The two plugins (repositories) above, namely drbeco/vimtemplates and drbeco/vimcolors8 are optional and are there just to test the installation. You need some plugin there to run :PlugInstall and this two are small, easy and compatible. Feel free to change, but I recommend you first install all, check if it is ok, then change all vim-plug session to your taste.

  1. Create a directory /etc/vim/plugged/. Make sure all users can read/execute it.

Add the following script to the plugged directory (make it executable):

$ cat /etc/vim/plugged/vppinstall.sh

#!/bin/bash

# notice
echo "vppinstall.sh (C) 2017 Dr. Beco: Correcting plugin's permissions"

# work in plugged directory
cd /etc/vim/plugged

# execute (open) and read directories
find . -type d ! -wholename "*/.git*" -exec chmod o+rx {} \;

# read all files
find . -type f ! -wholename "*/.git*" -exec chmod o+r {} \;

This script will run as post-installation hook to correct the permissions of the files. You can set stick-bits or redefine your UMASK instead of running this script, but unless you know the security risks I don't recommend.

Almost done.

  1. Reload .vimrc and run :PlugInstall to install plugins. For each new plugin you add to your vimrc.local, make sure it calls the post-installation script, or else users won't be able to use them.

--

Download

To download the plug.vim file, use:

curl -fLo /etc/vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
DrBeco
  • 11,237
  • 9
  • 59
  • 76
  • Note: I'm still debugging some minor problems with this answer. The issue is at github original vim-plug repo. If you know how to solve them, you are welcome to join. I'll update my answer when it is all worked out. Here the link to the issue: https://github.com/junegunn/vim-plug/issues/657 – DrBeco Jul 11 '17 at 23:05