Change /colors/ & /syntax/ paths or source colors & syntax from shared directory?

18 views
Skip to first unread message

nakore

unread,
Sep 25, 2019, 1:01:41 PM9/25/19
to vim_use
All,

Is there a way to use a /colors/ or /syntax/ file out of some directory other than $VIMRUNTIME?

At work, I work on a plethora of Linux servers (as an Oracle DBA) and do not have Linux SA (root) access.  I can "see" the files in $VIMRUNTIME but I cannot edit or add at all.

I'd like to be able to create some custom color.vim and syntax.vim files/schemes for my own use (not using those filenames, of course).

Ideally, what I'd like to do is:
  1. Write a custom color scheme.
  2. Place it on a common share (common to all the Linux servers) and not have to put it on every, single, server.
  3. Be able to use the color scheme:
    1. Either include/call/source that color scheme file(s) in my common .vimrc file?
    2. Or, at least, be able to manually call that color scheme if/when I need/want it?
  4. And, I'd like to be able to do that same sort of thing with syntax file(s)?
Is that possible without getting access to (in our case) /usr/share/vim/vim74/...?

Thanks!!

nakore

nakore

unread,
Sep 25, 2019, 5:46:42 PM9/25/19
to vim_use
After asking that question(s), I had a moment to day dream.  A thought suddenly jumped into my head!!  I think I answered my own question when I said, "...source that color scheme file...".  I JUST tried it and it really does appear to be just that simple!!  I put a copy of an existing color file (shine.vim) up on a share area, renamed it something unique (rrshine.vim), then just did a :source <path>/rrshine.vim and it switched my color scheme to "shine"!!  I did a :source back to my /usr/share/vim/vim74/delek.vim and it set the scheme back to delek!!

So, it really was that simple and I was just brain farting on it!!

Thanks,

Tony Mechelynck

unread,
Sep 25, 2019, 6:33:00 PM9/25/19
to vim_use
On Wed, Sep 25, 2019 at 7:01 PM nakore <nak...@gmail.com> wrote:
>
> All,
>
> Is there a way to use a /colors/ or /syntax/ file out of some directory other than $VIMRUNTIME?

Yes. Under :help 'runtimepath' you will see that Vim looks for its
runtime files in several directories. For instance, on Unix-like
systems, the following directories aree checked in the following
order:

~/.vim (under your home directory) for your own scripts
$VIM/vimfiles (a non-version-dependent location) for the sysadmin's
system-wide scripts
$VIMRUNTIME — ONLY for scripts distributed with Vim, any Vim update
may silently replace any of them
$VIM/vimfiles/after — for the sysadmin's "after" snippets, to override
any of the above
~/.vim/after — for your own "after" snippets, to override any of the above.

As you can see, you have the first and last word about any aspect of
Vim's runtime configuration.

In addition, the :packadd command may add additional directories, each
specific to one package. For instance, $VIMRUNTIME/vimrc_example.vim
includes the following at is very end:

" Add optional packages.
"
" The matchit plugin makes the % command work better, but it is not backwards
" compatible.
" The ! means the package won't be loaded right away but when plugins are
" loaded during initialization.
if has('syntax') && has('eval')
packadd! matchit
endif

This adds $VIMRUNTIME/pack/dist/opt/matchit to the 'runtimepath'
option to enable the matchit plugin.

>
> At work, I work on a plethora of Linux servers (as an Oracle DBA) and do not have Linux SA (root) access. I can "see" the files in $VIMRUNTIME but I cannot edit or add at all.

You should NEVER modify anything under $VIMRUNTIME because any Vim
update may silently remove anything you change there. But you may
override those scripts with your own, see above.
>
> I'd like to be able to create some custom color.vim and syntax.vim files/schemes for my own use (not using those filenames, of course).
>
> Ideally, what I'd like to do is:
>
> Write a custom color scheme.
> Place it on a common share (common to all the Linux servers) and not have to put it on every, single, server.
> Be able to use the color scheme:

>
> Either include/call/source that color scheme file(s) in my common .vimrc file?
> Or, at least, be able to manually call that color scheme if/when I need/want it?

Both are possible. Or you could (depending on how each server finds
the shared files) put a symlink or a "source" statement to it at the
appropriate location under ~/.vim (for Unix) or ~/vimfiles (for
Windows) in your home space on each server.
>
> And, I'd like to be able to do that same sort of thing with syntax file(s)?
>
> Is that possible without getting access to (in our case) /usr/share/vim/vim74/...?

Vim 7.4 is old stuff. Nowadays it ought to be /usr/share/vim/vim81/...
>
> Thanks!!
>
> nakore

Best regards,
Tony.

Christian Brabandt

unread,
Sep 26, 2019, 4:10:27 AM9/26/19
to vim_use

On Do, 26 Sep 2019, Tony Mechelynck wrote:

> In addition, the :packadd command may add additional directories, each
> specific to one package. For instance, $VIMRUNTIME/vimrc_example.vim
> includes the following at is very end:

Note that Vim 7.4 does not have the `:pack` command and also not the
`packpath` option setting.

Best,
Christian
--
Die meisten Meinungen kommen zustande, indem man vergißt, wo man sie
gehört oder gelesen hat.
-- Moritz Heimann
Reply all
Reply to author
Forward
0 new messages