It looks like
user-setup sets up
.vimrc to look for
ocp-indent's vim indent config file in the wrong place.
user-setup adds a line to
ocp-indent doesn’t create that file.
Two questions: (1) Could there be something odd about my general configuration that is causing this? (2) Where would I file an issue? With
Freshly install latest
ocp-indent (1.6.1) and
user-setup (0.6), and then:
~$ opam user-setup install
~$ tail -4 .vimrc
if count(s:opam_available_tools,"ocp-indent") == 0
" ## end of OPAM user-setup addition for vim / ocp-indent ## keep this line
~$ ls -l /Users/marshall/.opam/4.06.1/share/vim/syntax/ocp-indent.vim
ls: /Users/marshall/.opam/4.06.1/share/vim/syntax/ocp-indent.vim: No such file or directory
~$ cd .opam/4.06.1/share/
~/.opam/4.06.1/share$ ls -ld vim
ls: vim: No such file or directory
~/.opam/4.06.1/share$ find . -name '*vim*'
It looks like that last file is what
user-setup should be referencing in the
source line in
@mars0i It’s been fixed in
opam-user-setup master branch (commit). A new version of the package will be released soon.
Until the release, you can patch manually your
- source "/Users/marshall/.opam/4.06.1/share/vim/syntax/ocp-indent.vim"
+ source "/Users/marshall/.opam/4.06.1/share/ocp-indent/vim/indent/ocaml.vim"
@rjbou, excellent–thanks very much.
New version user-setup.0.7 (containing the fix) released.
Well, … I am still having trouble with
user-setup and vim.
I have a lot of stuff in my normal .vimrc, and something in there interacts with the OCaml config that
user-setup installs in ways that mess up either the OCaml config or behavior on other files that’s important to me.
A partial solution is to have one .vimrc file that contains only
user-setup-generated code, and a separate file with my normal configuration code. I can load an alternate initialization file with
vim -u .vimrc.alternate.
The weird thing is that
-u file definitely initializes
file instead of .vimrc, but if
file is the file containing all and only
user-setup-generated code, it doesn’t seem to work. For example, I don’t get OCaml indentation behavior. However, if I put the all-and-only
user-setup-generated code in .vimrc, it does get executed. It seems as if there is something in the code that won’t work with
-u, but will work during the normal initialization process. As I said, this seems weird.
I don’t think it’s the responsibility of
user-setup maintainers to debug or to fix the problem, and it’s not an OCaml problem per se, but I thought I’d mention it here anyway.
Here is a solution to the problem that the
user-setup configurations were executing when they were in
.vimrc but not when they were in another file that I ran with the commandline option
It turns out that vim’s system initialization file isn’t run if you use
-u. (You have to read the internal
:help initialization file carefully to figure this out. You can find out the name and path of this file with
My new solution is to put the
user-setup configuration in a file other than
.vimrc, which I call
.vimrc.ocaml, but add a line to execute the system initialization file at the beginning of this script. On my system this line is:
Then I can use a different script as my .vimrc for everything except editing OCaml source, but use a shell alias that executes
gvim -u ~/.vimrc.ocaml.
I’m happy now.