" breakpts.vim " Author: Hari Krishna " Last Change: 10-Jun-2003 @ 19:47 " Created: 09-Jan-2003 " Requires: Vim-6.2, genutils.vim(1.4), multvals.vim(3.2) " Depends On: foldutil.vim (1.2) " Version: 2.0.2 " Acknowledgements: " - Thanks a lot to David Fishburn {fishburn at sybase dot com} for " providing a lot of feedback and ideas, and helping me with finding " problems. The plugin is much more usable and bug free because of him. " Licence: This program is free software; you can redistribute it and/or " modify it under the terms of the GNU General Public License. " See http://www.gnu.org/copyleft/gpl.txt " Download From: " http://www.vim.org/script.php?script_id=618 " Description: " - This plugin allows you to visually set/clear breakpoints in Vim " functions/scripts instead of using breakadd/breakdel commands. The " advantage is that you know exactly on which line you are setting the " breakpoint, especially when you use line-contnuation in your scripts. " Though setting breakpoints is the main intention, it is also useful as a " Vim function and script browser. " - Open the BreakPts window through WinManager (as described in the " installation section below) or by stand-alone using :BreakPts command " (or by pressing the hot key, if you have chosen one). You can use " :BreakPts (or the hot key) again to close the window. " - The window is normally first opened with the list of all the functions " that are loaded into Vim. But you can toggle between the list of " functions, scripts and breakpoints, by using the :BPScripts, " :BPFunctions and :BPBrklist commands respectively, while in the BreakPts " window. " - Search for the function/script that you are interested in and press " or use :BPSelect command to get the listing. Alternatively you can use " :BPListFunc or :BPListScript command to list a function or script " directly. This is also the only way you can set a breakpoint in an " unloaded plugin (such as a ftplugin that is yet to be loaded). " " TIP: You can use Vim's function or file name completion mechanism (if " enabled) with these commands. For script local functions, you can have " vim fill in the prefix (instead of manually typing it in), by " prefixing the function name an asterisk before attempting to complete. " - You can navigate the history by using and (or :BPBack and " :BPForward) commands, just like in an HTML browser. " - To toggle a breakpoint at any line, press (or :BPToggle) command. " The plugin uses Vim's |:sign| feature to visually indicate the existence " of a breakpoint. You can also use :BPClearAll command to clear all the " breakpoints. " - You can save the breakpoints into a global variable using the :BPSave " command while in the BreakPts window. The command takes in the name of a " global variable where the commands to recreate the breakpoints will be " saved. You can later reload these breakpoints by simply executing the " variable: " " :BPSave BL " :BPClearAll " . " . " :exec BL " " You can also use this technique to save and restore breakpoints across " sessions. For this, just make sure that the '!' option in 'viminfo' is " set: " " :set viminfo^=! " " and use a variable name that starts with an uppercase letter and contain " only uppercase letters and underscore characters (see help on " 'viminfo'). When you are no longer interested in saving and restoring a " breaklist, it is advisable to unlet the corresponding global variable. " - To make it easier to jump from one breakpoint to another, the plugin " defines two commands, [b and ]b (or :BPPrevious and :BPNext). Also, if " the foldutil.vim plugin is found to be installed, the plugin " automatically folds all the lines that do not have a breakpoint (with a " context of g:brkptsFoldContext, which has a default value of 3). This " feature is automatically disabled if foldutil.vim is not found to be " installed, but you can also set g:brkptsCreateFolds to 0 to explicitly " disable it. " - On the scripts view, you can use :BPReload (or O) to reload a script " after unletting the corresponding g:loaded_ variable. This " is intended to be used with the regular plugins, not the others such as " ftplugin, indent, syntax, colors or compiler plugins as these plugins " will automatically be reloaded by Vim at appropriate times. " " TIP: You can use this command to reload a new version of a plugin " without restarting your vim, but make sure the plugin supports such an " operation. Many plugins may not be designed to be just reloaded this way " as the script local variables could get reset causing it to misbehave. " - The contents of BreakPts window is cached, so to see the latest listing " at any time, refresh the window by pressing 'R' (or :BPRefresh) command. " You also need to refresh to see the breakpoints added/removed manually. " Installation: " - Place the plugin in a plugin diretory under runtimepath and configure " WinManager according to your taste. E.g: " " let g:winManagerWindowLayout = 'FileExplorer,BreakPts' " " You can then switch between FileExplorer and BreakPts by pressing ^N " and ^P. " - If you don't want to use WinManager, you can still use the :BreakPts " comamnd or assign a hotkey by placing the following in your vimrc: " " nmap BreakPts " " You can substitute any key or sequnce of keys for in the above map. " - Requires multvals.vim to be installed. Download from: " http://www.vim.org/script.php?script_id=171 " - Requires genutils.vim to be installed. Download from: " http://www.vim.org/script.php?script_id=197 " - To have the g:brkptsCreateFolds feature enabled, install the " foldutil.vim plugin. Download from: " http://www.vim.org/script.php?script_id=158 " - Set g:brkptsSortFunctions if you want the functions to be sorted, but this " can slowdown the first appearance (and everytime it is refreshed) of the " BreakPts window. To make the sort quicker, you can set the value of " g:brkptsSortExternalCmd to the name(if already in PATH)/path of an " external command (e.g., "sort"). This will make the plugin use external " sort (which in general is much faster) instead of the built-in sort. " - Set g:brkptsDefStartMode to 'script', 'function' or 'breaklist' to start " the browser in that mode. " - Set the '!' flag in viminfo if you want to save the breaklist across " sessions (see usage above). " TODO: " - Why is the column position getting reset in the listing window (only), " during the navigation? " - We need syntax rules for the BPScripts screen. " - A menu will be useful for those who are used to menus. if exists('loaded_breakpts') || v:version < 602 finish endif let loaded_breakpts = 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 " Initialization {{{ command! -nargs=0 BreakPts :call BrowserMain(0) nnoremap