contrib/vim/hgcommand.vim
changeset 3532 04d44c3d64f7
parent 3528 bf48ca46139b
equal deleted inserted replaced
3531:b5de4d5d60be 3532:04d44c3d64f7
    27 
    27 
    28 " loaded_hgcommand is set to 1 when the initialization begins, and 2 when it
    28 " loaded_hgcommand is set to 1 when the initialization begins, and 2 when it
    29 " completes.  This allows various actions to only be taken by functions after
    29 " completes.  This allows various actions to only be taken by functions after
    30 " system initialization.
    30 " system initialization.
    31 
    31 
    32 if exists("loaded_hgcommand")
    32 if exists("g:loaded_hgcommand")
    33    finish
    33    finish
    34 endif
    34 endif
    35 let loaded_hgcommand = 1
    35 let g:loaded_hgcommand = 1
    36 
    36 
    37 " store 'compatible' settings
    37 " store 'compatible' settings
    38 let s:save_cpo = &cpo
    38 let s:save_cpo = &cpo
    39 set cpo&vim
    39 set cpo&vim
    40 
    40 
    43 
    43 
    44 function! s:HGCleanupOnFailure(err)
    44 function! s:HGCleanupOnFailure(err)
    45   echohl WarningMsg
    45   echohl WarningMsg
    46   echomsg s:script_name . ":" a:err "Plugin not loaded"
    46   echomsg s:script_name . ":" a:err "Plugin not loaded"
    47   echohl None
    47   echohl None
    48   let loaded_hgcommand = "no"
    48   let g:loaded_hgcommand = "no"
    49   unlet s:save_cpo s:script_name
    49   unlet s:save_cpo s:script_name
    50 endfunction
    50 endfunction
    51 
    51 
    52 if v:version < 602
    52 if v:version < 602
    53   call <SID>HGCleanupOnFailure("VIM 6.2 or later required.")
    53   call <SID>HGCleanupOnFailure("VIM 6.2 or later required.")
   564   let l:doc_buf = bufnr("%")
   564   let l:doc_buf = bufnr("%")
   565 
   565 
   566   1
   566   1
   567   " Delete from first line to a line starts with
   567   " Delete from first line to a line starts with
   568   " === START_DOC
   568   " === START_DOC
   569   silent 1,/^=\{3,}\s\+START_DOC\C/ d
   569   silent 1,/^=\{3,}\s\+START_DOC\C/ delete _
   570   " Delete from a line starts with
   570   " Delete from a line starts with
   571   " === END_DOC
   571   " === END_DOC
   572   " to the end of the documents:
   572   " to the end of the documents:
   573   silent /^=\{3,}\s\+END_DOC\C/,$ d
   573   silent /^=\{3,}\s\+END_DOC\C/,$ delete _
   574 
   574 
   575   " Add modeline for help doc: the modeline string is mangled intentionally
   575   " Add modeline for help doc: the modeline string is mangled intentionally
   576   " to avoid it be recognized by VIM:
   576   " to avoid it be recognized by VIM:
   577   call append(line("$"), "")
   577   call append(line("$"), "")
   578   call append(line("$"), " v" . "im:tw=78:ts=8:ft=help:norl:")
   578   call append(line("$"), " v" . "im:tw=78:ts=8:ft=help:norl:")
  1046 " Section: HG buffer management commands {{{2
  1046 " Section: HG buffer management commands {{{2
  1047 com! HGDisableBufferSetup call HGDisableBufferSetup()
  1047 com! HGDisableBufferSetup call HGDisableBufferSetup()
  1048 com! HGEnableBufferSetup call HGEnableBufferSetup()
  1048 com! HGEnableBufferSetup call HGEnableBufferSetup()
  1049 
  1049 
  1050 " Allow reloading hgcommand.vim
  1050 " Allow reloading hgcommand.vim
  1051 com! HGReload unlet! loaded_hgcommand | runtime plugin/hgcommand.vim
  1051 com! HGReload unlet! g:loaded_hgcommand | runtime plugin/hgcommand.vim
  1052 
  1052 
  1053 " Section: Plugin command mappings {{{1
  1053 " Section: Plugin command mappings {{{1
  1054 nnoremap <silent> <Plug>HGAdd :HGAdd<CR>
  1054 nnoremap <silent> <Plug>HGAdd :HGAdd<CR>
  1055 nnoremap <silent> <Plug>HGAnnotate :HGAnnotate<CR>
  1055 nnoremap <silent> <Plug>HGAnnotate :HGAnnotate<CR>
  1056 nnoremap <silent> <Plug>HGCommit :HGCommit<CR>
  1056 nnoremap <silent> <Plug>HGCommit :HGCommit<CR>
  1198 delfunction <SID>HGInstallDocumentation
  1198 delfunction <SID>HGInstallDocumentation
  1199 delfunction <SID>HGFlexiMkdir
  1199 delfunction <SID>HGFlexiMkdir
  1200 delfunction <SID>HGCleanupOnFailure
  1200 delfunction <SID>HGCleanupOnFailure
  1201 unlet s:script_version s:script_name
  1201 unlet s:script_version s:script_name
  1202 
  1202 
  1203 let loaded_hgcommand=2
  1203 let g:loaded_hgcommand=2
  1204 silent do HGCommand User HGPluginFinish
  1204 silent do HGCommand User HGPluginFinish
  1205 
  1205 
  1206 let &cpo = s:save_cpo
  1206 let &cpo = s:save_cpo
  1207 unlet s:save_cpo
  1207 unlet s:save_cpo
  1208 " vim:se expandtab sts=2 sw=2:
  1208 " vim:se expandtab sts=2 sw=2: