1. Ian Liu Rodrigues
  2. Vim Hg2O

Source

Vim Hg2O / hg2o.vim

" hg2o.vim - Vim Hg2O is a wrapper for Mercurial version control system.
" Maintainer:  Ian Liu Rodrigues
" Version:     0.1

if exists('g:loaded_hg2o') || &cp
  finish
endif
let g:loaded_hg2o = 1

let s:HG = 'hg'

fun! s:throw(msg)
  let v:errmsg = 'Hg2O: ' . a:msg
  throw v:errmsg
endf

" Returns the root dir of current buffer's HG repo
fun! s:root()
  if exists('b:hg_root') && b:hg_root !=# ''
    return b:hg_root
  endif
  let b:hg_root = system(s:HG . ' root')
  if v:shell_error == 0
    return b:hg_root
  endif
  call s:throw('not a mercurial repository: ' . expand('%:p'))
endf

com! -buffer -nargs=? Hg :execute s:Hg(<q-args>)

fun! s:Hg(cmd) abort
  exe '!' . s:HG . ' ' . a:cmd
endf

fun! s:HgComplete()
  return '!HGPLAINEXCEPT=alias HGPLAIN=1 hg debugcomplete'
endf