I'll take a tangent and answer the question that will arise when you start sharing more than a single set of syntax files (and attempt ot make the question more "on-topic" in the process :) ).
There is any vim guideline to how to share?
You could say that with Vim 8 there is (although it can be debatable whether it is or it isn't a guideline). In :help packages
(or :help package-create
) the Vim manual describes a method to disengage files in the directories in .vim
between different packages. Therefore the first thing you should do before sharing the files is to place them inside such a package. Instead of:
~/.vim/syntax/ChatScript.vim
~/.vim/ftdetect/ChatScript.vim
You should really have something of the lines:
~/.vim/pack/mypackages/start/ChatScript/syntax/ChatScript.vim
~/.vim/pack/mypackages/start/ChatScript/ftdetect/ChatScript.vim
So the directory ChatScript
becomes your package and can be distributed in any way you want. Some examples:
- With
git clone
from github
- By zipping it together (zip, tar, whatever) and unzipping at the desirable location
- Symlinks to other user's public folders
- Constructing a VimBall (but I'd recommend against it since it requires some extra knowledge to install in the right place in Vim 8).
Really, you can distribute it whichever way you find more convenient, and you do not need to distribute it in only a single way either. On the other hand the first option (git clone
) is quite popular among Vim users.
Extra Notes
The directory names mypackages
and ChatScript
in the above are completely up to you. But the names of the other directories are important, and so is the number of subdirectories. The final objective of Vim packages is to allow for several groups of packages. For example
~/.vim/pack/mypackages/start/ChatScript/syntax/ChatScript.vim
~/.vim/pack/mypackages/start/ChatScript/ftdetect/ChatScript.vim
~/.vim/pack/third-party/start/csv.vim/...
~/.vim/pack/third-party/start/airline/...
~/.vim/pack/third-party/opt/django.vim/syntax/...
~/.vim/pack/third-party/opt/django.vim/plugin/...
Note the opt
directory there (it is for optionally loaded packages), read the :h packages
or the relevant question here on vi.SE
Before Vim 8
The packages system is not present in Vim 7 and earlier, but it was not born from nothing. Several plugins offered a very similar system of packaging a distibution of Vim files (syntax, autoloads, etc) into a single directory and align several such directories together.
We have a more-or-less complete list of these plugins, with their descriptions, advantages and disadvantages.
From those I always used pathogen. Which I dumped in my ~/.vim/autoload/pathogen.vim
using the default ~/.vim/bundle
for packages. The difference from the Vim 8 packages above is that it does not have groups of packages, everything goes into ~/.vim/bundle
. So, the directory structure above would be (actually was):
~/.vim/bundle/ChatScript/syntax/ChatScript.vim
~/.vim/bundle/ChatScript/ftdetect/ChatScript.vim
~/.vim/bundle/csv.vim/...
~/.vim/bundle/airline/...
~/.vim/bundle/django.vim/syntax/...
~/.vim/bundle/django.vim/plugin/...
Then, to distribute them, it is the same story. Use any method(s) you like and tell the user to dump into a subdirectory of bundle
. Vundle does the same, just that by default it loads from gihub automatically. Other plugins can do even more (e.g. check for updates).