*narrow.txt* Emulate Emacs' narrowing feature Version 0.2.1 Script ID: 2097 Copyright (C) 2007 kana <http://whileimautomaton.net/> License: MIT license {{{ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. }}} CONTENTS *narrow-contents* Introduction |narrow-introduction| Interface |narrow-interface| Commands |narrow-commands| Functions |narrow-functions| Customizing |narrow-customizing| Bugs |narrow-bugs| Changelog |narrow-changelog| ============================================================================== INTRODUCTION *narrow-introduction* *narrow* is a Vim plugin to emulate Emacs' narrowing feature. From GNU Emacs Manual: Narrowing means focusing in on some portion of the buffer, making the rest temporarily inaccessible. The portion which you can still get to is called the accessible portion. Canceling the narrowing, which makes the entire buffer once again accessible, is called widening. The bounds of narrowing in effect in a buffer are called the buffer's restriction. Narrowing can make it easier to concentrate on a single subroutine or paragraph by eliminating clutter. It can also be used to limit the range of operation of a replace command or repeating keyboard macro. Note that there are some differences from the original behavior. See |narrow-bugs| for the detail. Requirements: - Vim 7.0 or later Latest version: http://github.com/kana/config/commits/vim-narrow Document in HTML format: http://kana.github.com/config/vim/narrow.html ============================================================================== INTERFACE *narrow-interface* ------------------------------------------------------------------------------ COMMANDS *narrow-commands* *:Narrow* :[range]Narrow Narrow down to [range]. The default [range] is the current line. See |g:narrow_allow_overridingp| in the case of the buffer is already narrowed. *:Widen* :Widen Widen to make the entire buffer visible again. If the buffer is not narrowed, nothing will happen. ------------------------------------------------------------------------------ FUNCTIONS *narrow-functions* *narrow#Narrow()* narrow#Narrow({line1}, {line2}) Function version of |:Narrow|. Narrow down to between {line1} and {line2}. Return true on success or false on failure. *narrow#Widen()* narrow#Widen() Function version of |:Widen|. Return true on success or false on failure. ============================================================================== CUSTOMIZING *narrow-customizing* *b:narrow_original_state* b:narrow_original_state The variable to save the state of the buffer before narrowing. This variable doesn't exist when the buffer is not narrowed. *g:narrow_allow_overridingp* g:narrow_allow_overridingp When the buffer is already narrowed, |:Narrow| is allowed if this variable is set to true. Otherwise it's not allowed, so nothing will happen. ============================================================================== BUGS *narrow-bugs* - Narrowing is based on Vim's |folding| feature. So you can * See hidden portions as folds. * Show a hidden portion by |zR| or other commands. * Move the cursor into a hidden portion. * Modify the content of a hidden portion by |:s| or other commands. In Emacs, these actions aren't allowed. - The following situation is not supported: The same buffer showed in two or more windows. ============================================================================== CHANGELOG *narrow-changelog* 0.2.1 2009-02-28T16:55:24+09:00 *narrow-changelog-0.2.1* - Fix minor bugs: - |:Widen| raises an error for buffers without fold. - |:Narrow| doesn't hide lines smaller than 'foldminlines'. 0.2 2007-12-29T07:24:53+09:00 *narrow-changelog-0.2* - Fix |:Narrow| and |:Widen| not to use temporary files. Now |:Widen| correctly works even if the target buffer is |:Narrow|'ed by two or more Vim processes. - Modify |:Narrow| to |zz| after narrowing for visibility. - Modify |:Narrow| to include all lines of closed folds in [range]. 0.1 2007-12-28T01:13:48+09:00 *narrow-changelog-0.1* - Fix the bug that 'foldenable' is not set after |:Narrow|. - Fix the bug that the cursor is moved to somewhere after |:Widen|. - Add |g:narrow_allow_overridingp|. 0.0 2007-12-15T22:34:52+09:00 *narrow-changelog-0.0* - Initial version. ============================================================================== vim:tw=78:ts=8:ft=help:norl:fen:fdl=0:fdm=marker: