" ============================================================================= " Name Of File: rcs-menu.vim " Description: Interface to RCS Version Control. " Author: Jeff Lanzarotta " URL: http://lanzarott.tripod.com/vim.htm " Date: Saturday, February 3, 2001 " Version: 6.0.2 " Copyright: None. " Usage: These command and gui menu displays useful revision control " system (rcs). " functions. " Configuration: Your rcs executables must be in your path. " ============================================================================= " Has this already been loaded? if exists("loaded_rcs_menu") finish endif let loaded_rcs_menu = 1 if has("gui") amenu RCS.Initial\ Check\ In,init :!ci -i -u %:e! amenu RCS.-SEP1- amenu RCS.Check\ In,ci :!ci -u %:e! amenu RCS.Check\ Out,co :!co %:e! amenu RCS.Check\ Out\ (Locked),lock :!co -l %:e! amenu RCS.Revert\ to\ Last\ Version,revert :!co -f %:e! amenu RCS.-SEP2- amenu RCS.Show\ History,log :call RCSShowLog("/rlog", "rlog") amenu RCS.-SEP3- amenu RCS.Show\ Differences,diff :call RCSShowDiff("/rcsdiff", "rcsdiff") endif " Mappings: if(v:version >= 600) map init :!ci -i -u %:e! map ci :!ci -u %:e! map co :!co %:e! map lock :!co -l %:e! map log :call RCSShowLog("/rlog", "rlog") map diff :call RCSShowDiff("/rcsdiff", "rcsdiff") else map ,init :!ci -i -u %:e! map ,ci :!ci -u %:e! map ,co :!co %:e! map ,lock :!co -l %:e! map ,log :call RCSShowLog("/rlog", "rlog") map ,diff :call RCSShowDiff("/rcsdiff", "rcsdiff") endif " RCSShowLog " Show the log results of the current file with a revision control system. function! RCSShowLog(bufferName, cmdName) call s:ReadCommandInBuffer(a:bufferName, a:cmdName) endfunction " ShowDiff " Show the diffs of the current file with a revision control system. function! RCSShowDiff(bufferName, cmdName) call s:ReadCommandInBuffer(a:bufferName, a:cmdName) endfunction " ReadCommandInBuffer " - bufferName is the name which the new buffer with the command results " should have. " - cmdName is the command to execute. function! s:ReadCommandInBuffer(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