Wednesday, September 25, 2019

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

On Wed, Sep 25, 2019 at 7:01 PM nakore <nakore@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.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsYtvneovGdkWdGzFf8%3D3cxfwdt%3DWxJzd04%2BDgwXvcexw%40mail.gmail.com.

No comments:

Post a Comment