package ocamlformat
 sectionYPositions = computeSectionYPositions($el), 10)"
  x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
  >
  
  
On This Page
  
  
  Auto-formatter for OCaml code
Install
    
    dune-project
 Dependency
    
    
    
    github.com
    
    
    
    
    Readme
    
    
    
    
    Changelog
    
    
    
    
    MIT; LGPL-2.1-only WITH OCaml-LGPL-linking-exception License
    
    
    
    Edit opam file
    
    
    Versions (27)
Authors
Maintainers
Sources
  
    
      ocamlformat-0.26.0.tbz
    
    
        
    
  
  
  
    
  
  
    
  
        sha256=031494ab770cef10a8f6aa1cbeb5660e46c3aa6c0cd457b110fec859a75e877d
    
    
  sha512=35c0131f04c2c8ceb94f0f400e4b56690405ddebb482aec0c9962163001d9fd5b593455df08b508394949f2740ba28f1714dff9e1f17b618bdec62fd26fae281
    
    
  doc/howtos.html
How-To's
Using an autoformatter will make your process easier but it can also introduce a few pain points. Here are how to solve the most commonly encountered pain points.
Using OCamlFormat without breaking git blame
- Create 
.git-blame-ignore-revsin your project - Add revision(s) where the code was re-formatted
 
# Apply new formatting with OCamlFormat
2ceaf76b9f84cb632327c1479d0f30acfa3eeba2- Run 
git config --local blame.ignoreRevsFile .git-blame-ignore-revs - All future use of 
git blamewill now provide blame information omitting the reformatting commits: lines that were changed or added by an ignored commit will be blamed on the previous commit that changed that line or nearby lines. 
Resolve merge conflicts using Merge-fmt and OCamlFormat
Merge-fmt is a small wrapper on top of git commands to help resolve conflicts caused by code formatters.
There are three ways to use merge-fmt.
Standalone
Just call merge-fmt while there are unresolved conflicts. merge-fmt will try to resolve conflicts automatically.
As a Git mergetool
merge-fmt can act as a git mergetool. First configure the current git repository with
merge-fmt setup-mergetool
git config --local mergetool.mergefmt.cmd 'merge-fmt mergetool --base=$BASE --current=$LOCAL --other=$REMOTE -o $MERGED'
git config --local mergetool.mergefmt.trustExitCode trueThen, use git mergetool to resolve conflicts with git mergetool -t mergefmt.
As a git merge driver
merge-fmt can act as a git merge driver. Configure the current git repository to use merge-fmt as the default merge driver.
$ merge-fmt setup-merge
git config --local merge.mergefmt.name 'merge-fmt driver'
git config --local merge.mergefmt.driver 'merge-fmt mergetool --base=%O --current=%A --other=%B -o %A --name=%P'
git config --local merge.tool 'mergefmt'
git config --local merge.default 'mergefmt'
           sectionYPositions = computeSectionYPositions($el), 10)"
  x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
  >
  
  
  On This Page