Skip to content

Instantly share code, notes, and snippets.

@drvink
Forked from unhammer/merlin-init.sh
Last active September 4, 2015 10:37
Show Gist options
  • Save drvink/ebda44842ce7e15fe76d to your computer and use it in GitHub Desktop.
Save drvink/ebda44842ce7e15fe76d to your computer and use it in GitHub Desktop.
Create .merlin file for a project with all your ocamlfind packages and .opam sources in there
#!/bin/sh
if test -f .merlin; then
echo ".merlin already exists, bailing out ..." >&2
exit 1
else
# You could add your default EXT's and such to this list:
cat >.merlin <<EOF
S .
B _build
EOF
# Add PKG's:
ocamlfind list \
| awk '{ print "PKG "$1 }' >>.merlin
# See https://github.com/the-lambda-church/merlin/wiki/Letting-merlin-locate-go-to-stuff-in-.opam
find ~/.opam -name '*.cmt' -print0 \
| xargs -0 -I{} dirname '{}' \
| sort -u \
| awk '{ print "S "$0"\nB "$0 }' >> .merlin
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment