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() abort
  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=? -complete=customlist,s:HgComplete Hg :execute s:Hg(<q-args>)

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

fun! s:HgComplete(A, L, P) abort
  let items = system(s:HG . ' debugcomplete '. a:A)
  if v:shell_error == 0
    return split(items, '\n')
  endif
endf
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.