From f7d4f65f222d65de4a45101f35e264fbbf36f647 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Wed, 21 Nov 2012 11:21:02 -0800 Subject: Adding vim scratch plugin --- base/vim/plugin/scratch.vim | 134 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 base/vim/plugin/scratch.vim (limited to 'base/vim') diff --git a/base/vim/plugin/scratch.vim b/base/vim/plugin/scratch.vim new file mode 100644 index 0000000..9b83ea4 --- /dev/null +++ b/base/vim/plugin/scratch.vim @@ -0,0 +1,134 @@ +" scratch.vim +" Author: Abhilash Koneri (abhilash_koneri at hotmail dot com) +" Improved By: Hari Krishna Dara (hari_vim at yahoo dot com) +" Last Change: 25-Feb-2004 @ 09:48 +" Created: 17-Aug-2002 +" Version: 1.0.0 +" Download From: +" http://www.vim.org/script.php?script_id=389 +"---------------------------------------------------------------------- +" This is a simple plugin that creates a scratch buffer for your +" vim session and helps to access it when you need it. +" +" If you like the custom mappings provided in the script - hitting +" should create a new scratch buffer. You can do your scribes +" here and if you want to get rid of it, hit again inside scratch buffer +" window. If you want to get back to the scratch buffer repeat . Use +" ShowScratchBuffer and InsShowScratchBuffer to customize these +" mappings. +" +" If you want to designate a file into which the scratch buffer contents +" should automatically be dumped to, when Vim exits, set its path to +" g:scratchBackupFile global variable. This file can be accessed just in case +" you happen to have some important information in the scratch buffer and quit +" Vim (or shutdown the m/c) forgetting to copy it over. The target file is +" force overwritten using the :write! command so make sure you set a file name +" that can accidentally be used for other purposes (especially when you use +" relative paths). I recommend a value of '/tmp/scratch.txt'. +" CAUTION: This feature works only when Vim generates VimLeavePre autocommad. +" +" Custom mappings +" --------------- +" The ones defined below are not very ergonomic! +"---------------------------------------------------------------------- +"Standard Inteface: to make a new ScratchBuffer, -again to hide one + +if exists('loaded_scratch') + finish +endif +let loaded_scratch = 1 + +" Make sure line-continuations won't cause any problem. This will be restored +" at the end +let s:save_cpo = &cpo +set cpo&vim + +if (! exists("no_plugin_maps") || ! no_plugin_maps) && + \ (! exists("no_scratch_maps") || ! no_scratch_maps) + if !hasmapto('ShowScratchBuffer',"n") + nmap ShowScratchBuffer + endif + if !hasmapto('InsShowScratchBuffer',"i") + imap InsShowScratchBuffer + endif +endif + +" User Overrideable Plugin Interface +nmap