*textobj-indent.txt*    Text objects for indented blocks of lines

Version 0.0.3
Script ID: 2484
Copyright (C) 2008 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                                        *textobj-indent-contents*

Introduction            |textobj-indent-introduction|
Interface               |textobj-indent-interface|
  Commands                |textobj-indent-commands|
  Functions               |textobj-indent-functions|
  Mappings                |textobj-indent-mappings|
Bugs                    |textobj-indent-bugs|
Changelog               |textobj-indent-changelog|




==============================================================================
INTRODUCTION                                    *textobj-indent-introduction*

*textobj-indent* is a Vim plugin to provide text objects to select a block of
lines which are similarly indented to the current line.

For example, if the content of a buffer as follows:
(here ">" means the current line under the cursor,
and "_" means a space to indent)
>
          if some_condition_is_satisfied
        > __if another_condition_is_satisfied
          ____call s:do_x()
          __endif

          __...
          __endif
          else
          __...
          endif
<
|<Plug>(textobj-indent-a)| will select lines as follows:
(here "|" indicates the selected line)
>
          if some_condition_is_satisfied
        >|__if another_condition_is_satisfied
         |____call s:do_x()
         |__endif
         |
         |__...
         |__endif
          else
          __...
          endif
<
|<Plug>(textobj-indent-i)| will select lines as follows:
>
          if some_condition_is_satisfied
        >|__if another_condition_is_satisfied
         |____call s:do_x()
         |__endif

          __...
          __endif
          else
          __...
          endif
<
More variants are also available.  See |textobj-indnet-mapping| for the
details.


Requirements:
- Vim 7.2 or later
- |textobj-user| 0.3.8 or later (vimscript#2100)

Latest version:
http://github.com/kana/config/commits/vim-textobj-indent

Document in HTML format:
http://kana.github.com/config/vim/textobj-indent.html




==============================================================================
INTERFACE                                       *textobj-indent-interface*

------------------------------------------------------------------------------
MAPPINGS                                        *textobj-indent-mappings*

These key mappings are defined in Visual mode and Operator-pending mode.

<Plug>(textobj-indent-a)                        *<Plug>(textobj-indent-a)*
                        Select a block of lines which are similarly indented
                        to the current line.  More precisely, it selects lines
                        which are:
                        - adjacent to the current line, and
                        - indented the same or more amount
                          as the current line, or empty line.

                        If the current line is empty, the indentation of the
                        next line will be used to select.  If that line is
                        also ampty, the indentation of the next line of that
                        line will be used instead.  And so forth.

                        See also |textobj-indent-introduction| for figures
                        which describe what lines to be selected by this
                        command.

<Plug>(textobj-indent-i)                        *<Plug>(textobj-indent-i)*
                        Like |<Plug>(textobj-indent-a)|, but it doesn't
                        include empty lines.

<Plug>(textobj-indent-same-a)                  *<Plug>(textobj-indent-same-a)*
<Plug>(textobj-indent-same-i)                  *<Plug>(textobj-indent-same-i)*
                        Like |<Plug>(textobj-indent-a)| or
                        |<Plug>(textobj-indent-i)|, but select a block of
                        lines with the same indentation level, not including
                        lines which are more indented than the current line.

                        For example, suppose you edit the following text:
                        (here ">" denotes the cursor position and "|" denotes
                        the current selection.)
>
                                  if some_condition_is_satisfied
                                    call special_stuff()
                                > endif
                                  call normal_stuff()
<
                        |<Plug>(textobj-indent-same-a)| selects lines as
                        follows:
>
                                  if some_condition_is_satisfied
                                    call special_stuff()
                                >|endif
                                 |call normal_stuff()
<
                        While |<Plug>(textobj-indent-a)| selects lines as
                        follows:
>
                                 |if some_condition_is_satisfied
                                 |  call special_stuff()
                                >|endif
                                 |call normal_stuff()
<




==============================================================================
CUSTOMIZING                                     *textobj-indent-customizing*

                                    *g:textobj_indent_no_default_key_mappings*
                                            *:TextobjIndentDefaultKeyMappings*
This plugin will define the following key mappings in Visual mode and
Operator-pending mode automatically.  If you don't want these key mappings,
define |g:textobj_indent_no_default_key_mappings| before this plugin is loaded
(e.g. in your |vimrc|).  You can also use |:TextobjIndentDefaultKeyMappings|
to redefine these key mappings.  This command doesn't override existing {lhs}s
unless [!] is given.

        {lhs}  {rhs}                    ~
        -----  ----------------------   ~
        ai      <Plug>(textobj-indent-a)
        ii      <Plug>(textobj-indent-i)
        aI      <Plug>(textobj-indent-same-a)
        iI      <Plug>(textobj-indent-same-i)




==============================================================================
BUGS                                            *textobj-indent-bugs*

- The current selection is not extended like |aw| nor |ip|
  whenever |<Plug>(textobj-indent-a)| or |<Plug>(textobj-indent-i)| is
  repeated in Visual mode.

- So that [count] is just ignored.

- See |textobj-user-bugs| for further information.




==============================================================================
CHANGELOG                                       *textobj-indent-changelog*

0.0.3   2009-08-30T12:06:37+09:00             *textobj-indent-changelog-0.0.3*
        Incompatible changes:
        - Requrie |textobj-user| 0.3.8 or later.

        Major improvements:
        - Add |<Plug>(textobj-indent-same-a)| and
          |<Plug>(textobj-indent-same-i)|.

        Minor improvements:
        - Revise the document a bit.
        - Add tests.
        - Fix a minor bug.
        - Revise to be autoloaded.

0.0.2   2009-04-17T17:45:31+09:00             *textobj-indent-changelog-0.0.2*
        - Fix the bug to calculate indentation levels.  Now these text objects
          target a set of lines with the same indentation as you see.

0.0.1   2009-02-27T13:04:37+09:00             *textobj-indent-changelog-0.0.1*
        - Add |<Plug>(textobj-indent-a)| and |<Plug>(textobj-indent-i)|.
        - Remove |<Plug>(textobj-indent)|.
          Use |<Plug>(textobj-indent-a)| instead.

0.0.0   2008-12-13T23:04:37+09:00             *textobj-indent-changelog-0.0.0*
        - Initial version.




==============================================================================
vim:tw=78:ts=8:ft=help:norl:fen:fdl=0:fdm=marker: