# HG changeset patch # User Vadim Gelfer # Date 1148787922 25200 # Node ID 075d2ddc4639c263d94f90027ed9baeda5310655 # Parent 091d555653a4ac4ce2ca7d5aaeb264652a2c542c contrib: move hg-menu.vim into contrib/vim directory diff -r 091d555653a4 -r 075d2ddc4639 contrib/hg-menu.vim --- a/contrib/hg-menu.vim Sat May 27 20:44:53 2006 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -" vim600: set foldmethod=marker: -" ============================================================================= -" Name Of File: hg-menu.vim -" Description: Interface to Mercurial Version Control. -" Author: Steve Borho (modified Jeff Lanzarotta's RCS script) -" Date: Wednesday, October 5, 2005 -" Version: 0.1.0 -" Copyright: None. -" Usage: These command and gui menu displays useful hg functions -" Configuration: Your hg executable must be in your path. -" ============================================================================= - -" Section: Init {{{1 -if exists("loaded_hg_menu") - finish -endif -let loaded_hg_menu = 1 - -" Section: Menu Options {{{1 -if has("gui") -" amenu H&G.Commit\ File,ci :!hg commit %:e! -" amenu H&G.Commit\ All,call :!hg commit:e! -" amenu H&G.-SEP1- - amenu H&G.Add\\add :!hg add % - amenu H&G.Forget\ Add\\fgt :!hg forget % - amenu H&G.Show\ Differences\\diff :call ShowResults("FileDiff", "hg\ diff") - amenu H&G.Revert\ to\ Last\ Version\\revert :!hg revert %:e! - amenu H&G.Show\ History\\log :call ShowResults("FileLog", "hg\ log") - amenu H&G.Annotate\\an :call ShowResults("annotate", "hg\ annotate") - amenu H&G.-SEP1- - amenu H&G.Repo\ Status\\stat :call ShowResults("RepoStatus", "hg\ status") - amenu H&G.Pull\\pull :!hg pull:e! - amenu H&G.Update\\upd :!hg update:e! -endif - -" Section: Mappings {{{1 -if(v:version >= 600) - " The default Leader is \ 'backslash' - map add :!hg add % - map fgt :!hg forget % - map diff :call ShowResults("FileDiff", "hg\ diff") - map revert :!hg revert %:e! - map log :call ShowResults("FileLog", "hg\ log") - map an :call ShowResults("annotate", "hg\ annotate") - map stat :call ShowResults("RepoStatus", "hg\ status") - map upd :!hg update:e! - map pull :!hg pull:e! -else - " pre 6.0, the default Leader was a comma - map ,add :!hg add % - map ,fgt :!hg forget % - map ,diff :call ShowResults("FileDiff", "hg\ diff") - map ,revert :!hg revert:e! - map ,log :call ShowResults("FileLog", "hg\ log") - map ,an :call ShowResults("annotate", "hg\ annotate") - map ,stat :call ShowResults("RepoStatus", "hg\ status") - map ,upd :!hg update:e! - map ,pull :!hg pull:e! -endif - -" Section: Functions {{{1 -" Show the log results of the current file with a revision control system. -function! ShowResults(bufferName, cmdName) - " Modify the shortmess option: - " A don't give the "ATTENTION" message when an existing swap file is - " found. - set shortmess+=A - - " Get the name of the current buffer. - let currentBuffer = bufname("%") - - " If a buffer with the name rlog exists, delete it. - if bufexists(a:bufferName) - execute 'bd! ' a:bufferName - endif - - " Create a new buffer. - execute 'new ' a:bufferName - - " Execute the command. - execute 'r!' a:cmdName ' ' currentBuffer - - " Make is so that the file can't be edited. - setlocal nomodified - setlocal nomodifiable - setlocal readonly - - " Go to the beginning of the buffer. - execute "normal 1G" - - " Restore the shortmess option. - set shortmess-=A -endfunction diff -r 091d555653a4 -r 075d2ddc4639 contrib/vim/hg-menu.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/vim/hg-menu.vim Sat May 27 20:45:22 2006 -0700 @@ -0,0 +1,93 @@ +" vim600: set foldmethod=marker: +" ============================================================================= +" Name Of File: hg-menu.vim +" Description: Interface to Mercurial Version Control. +" Author: Steve Borho (modified Jeff Lanzarotta's RCS script) +" Date: Wednesday, October 5, 2005 +" Version: 0.1.0 +" Copyright: None. +" Usage: These command and gui menu displays useful hg functions +" Configuration: Your hg executable must be in your path. +" ============================================================================= + +" Section: Init {{{1 +if exists("loaded_hg_menu") + finish +endif +let loaded_hg_menu = 1 + +" Section: Menu Options {{{1 +if has("gui") +" amenu H&G.Commit\ File,ci :!hg commit %:e! +" amenu H&G.Commit\ All,call :!hg commit:e! +" amenu H&G.-SEP1- + amenu H&G.Add\\add :!hg add % + amenu H&G.Forget\ Add\\fgt :!hg forget % + amenu H&G.Show\ Differences\\diff :call ShowResults("FileDiff", "hg\ diff") + amenu H&G.Revert\ to\ Last\ Version\\revert :!hg revert %:e! + amenu H&G.Show\ History\\log :call ShowResults("FileLog", "hg\ log") + amenu H&G.Annotate\\an :call ShowResults("annotate", "hg\ annotate") + amenu H&G.-SEP1- + amenu H&G.Repo\ Status\\stat :call ShowResults("RepoStatus", "hg\ status") + amenu H&G.Pull\\pull :!hg pull:e! + amenu H&G.Update\\upd :!hg update:e! +endif + +" Section: Mappings {{{1 +if(v:version >= 600) + " The default Leader is \ 'backslash' + map add :!hg add % + map fgt :!hg forget % + map diff :call ShowResults("FileDiff", "hg\ diff") + map revert :!hg revert %:e! + map log :call ShowResults("FileLog", "hg\ log") + map an :call ShowResults("annotate", "hg\ annotate") + map stat :call ShowResults("RepoStatus", "hg\ status") + map upd :!hg update:e! + map pull :!hg pull:e! +else + " pre 6.0, the default Leader was a comma + map ,add :!hg add % + map ,fgt :!hg forget % + map ,diff :call ShowResults("FileDiff", "hg\ diff") + map ,revert :!hg revert:e! + map ,log :call ShowResults("FileLog", "hg\ log") + map ,an :call ShowResults("annotate", "hg\ annotate") + map ,stat :call ShowResults("RepoStatus", "hg\ status") + map ,upd :!hg update:e! + map ,pull :!hg pull:e! +endif + +" Section: Functions {{{1 +" Show the log results of the current file with a revision control system. +function! ShowResults(bufferName, cmdName) + " Modify the shortmess option: + " A don't give the "ATTENTION" message when an existing swap file is + " found. + set shortmess+=A + + " Get the name of the current buffer. + let currentBuffer = bufname("%") + + " If a buffer with the name rlog exists, delete it. + if bufexists(a:bufferName) + execute 'bd! ' a:bufferName + endif + + " Create a new buffer. + execute 'new ' a:bufferName + + " Execute the command. + execute 'r!' a:cmdName ' ' currentBuffer + + " Make is so that the file can't be edited. + setlocal nomodified + setlocal nomodifiable + setlocal readonly + + " Go to the beginning of the buffer. + execute "normal 1G" + + " Restore the shortmess option. + set shortmess-=A +endfunction