-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please use plugins/packages instead of modifying the editor configs directly #1
Comments
Thanks for the input. I agree that using modules fitting nicely in the editor's ecosystem would be best, and all your points above make sense. Let me explain my design choice though:
One thing that worries me a bit also, with using plugins downloaded from the editor's system, is that these need to be in sync with the corresponding packages in OPAM (ocp-indent, merlin, ocp-index are all an OCaml tool + editor bindings), and that sounds tedious to maintain. All that said, it doesn't contradict your whole story. Indeed I have been installing the The real limitation with the current approach is, indeed, that it's static. It's ok for the current target but may get annoying with multiple switches. The possible workarounds I see:
So the chosen approach seemed like the only consistent and generic way to provide what I wanted. It's probably not the best for any given editor, but a big improvement overall on what we had before. On the other hand, if this is an occasion to gather efforts for OPAM to provide a consistent set of plugins for Emacs and Vim -- that'd be awesome. |
Idea
Make a difference between the minimal settings required to load the Vim/Emacs extensions, and setting up reasonable defaults for OCaml:
(a github repo for Vim, an ELPA/MELPA/marmale package for Emacs)
This way you can still customize your .vimrc/.emacs/.emacs.d in addition to the minimal settings required to get a reasonable OCaml editing experience.
For example things such as colorschemes, indentation settings, etc. is probably something the user wants to customize in addition to the settings provided by opam-user-setup.
Rationale
I use Pathogen to manage Vim plugins, and then adding a plugin is as simple as git clone (or submodule add-ing) something to my ~/.vim/bundle/, and they get autoloaded on startup.
There isn't a universal package manager for Vim though (some may use Vundle, Neobundle, vim-addon-manager, ... etc.) but they are all based on the idea of adding subdirs to the runtimepath.
I think there should be one Vim plugin that sets up Vim's runtime path to include stuff from ~/.opam//share/vim, and ~/.opam//share//vim, and also various settings for other plugins (syntastic, neocomplcache, etc.).
Then all the user has to do is to install this plugin the usual way, and whenever an opam package is installed that extends vim in some way it automatically gets loaded without needing to edit .vimrc or manually installing another plugin.
By default I don't think that it should change settings in .vimrc that are subjective (such as the colorscheme), it should just add the main plugin to Vim's runtime path (which will in turn add the others when its loaded and set defaults for other integration with other plugins).
When you generate a .vimrc from scratch, and want to change some of Vim's defaults that are not OCaml related please use sensible.vim, anything more than that is probably subjective and may conflict with user's customization (such as the colorscheme).
FWIW these are my OCaml related settings in my .vimrc:
The autocmd settings might be controversial, so its probably not a good idea to do them by default
(unless ocp-indent requires expandtab to work, will have to check).
I'm not an emacs user, but emacs has a package manager now, and the preferred way seems to be to install stuff from ELPA/MELPA/marmalade repositories.
Again it could be based on the same idea: one package that sets up emacs such that it loads all the stuff from the appropiate opam directories, sets up integration with other emacs packages and - since this is a real package manager - also depend on other packages that might be needed outside of opam (tuareg, etc.).
See for example how Prelude does it.
Care should also be taken if the user has a
.emacs.d
directory, but no.emacs
file, I don't know what the effect is if you create a.emacs
file in that case.The text was updated successfully, but these errors were encountered: