Permalink
Browse files

Expand README

  • Loading branch information...
b4winckler committed Jul 14, 2012
1 parent 16e5480 commit 1a2af2575e5273b9a2ab23ef1cd4598b0673448d
Showing with 31 additions and 13 deletions.
  1. +31 −13 README.markdown
View
@@ -1,31 +1,47 @@
# Angry text object
This plugin adds text object support for comma-separated arguments enclosed by
-brackets.
+brackets. (Etymology: "argument" is sometimes abbreviated to "arg" which
+means "angry" in Swedish.)
-For example, items in constructs like `(x, y, z)` or `[1, 32, 4]`,
+For example, arguments in constructs like `(x, y, z)` or `[1, 32, 4]`,
`{ {x, y}, {w, h} }` can be operated on using the objects `aa` (an argument,
includes the separator) or `ia` (inner argument, excludes the separator). The
text objects support a repeat count and can cope with nested lists, strings and
comments (strings and comments require the current file type to have proper
-syntax highlighting support).
+syntax highlighting support), as well as arguments on multiple lines.
There are also upper-case versions `aA` and `iA`. The lower-case objects will
-match at the beginning of an item, whereas the upper-case versions match at the
-end of an item. For example, if the cursor is on the first comma of
-`(x, y, z)`, then `daa` will result in `(x, z)` whereas `daA` will result in
-`(y, z)`.
+match a comma or bracket at the beginning of an argument, whereas the
+upper-case versions match a comma or bracket at the end of an argument. For
+example, if the cursor is on the first comma of `(x, y, z)`, then `daa` will
+result in `(x, z)` whereas `daA` will result in `(y, z)`. Another way to think
+of this is that `aa` includes the comma *before* an argument, whereas `aA`
+includes the comma *after* an argument.
The upper-case version includes whitespace and comments after the rightmost
-separator, and excludes whitespace and comments before the item. The
+separator, and excludes whitespace and comments before the argument. The
lower-case version includes whitespace and comments before the leftmost
-separator, and excludes whitespace and comments after the item. For example:
+separator, and excludes whitespace and comments after the argument. For
+example:
call( x, /* left */ y /* right */, z )
With the cursor on the `y`, typing `daa` results in `call( x /* right */, z )`,
whereas `daA` results in `call( x, /* left */ z )`.
+Some customization of the plugin is possible:
+
+- To disable all predefined mappings, add `let g:angry_disable_maps = 1`
+ to your `.vimrc`. This is useful if you dislike the choices of `aa`, `ia`,
+ `aA` and `iA`. See the script on [how to create custom mappings][plugin]
+ (look right next to the `g:angry_disable_maps` check).
+- The variable `g:angry_separator` defines the separator (default `,`). It
+ can be changed to any *single character*, e.g.
+ `let g:angry_separator = ':'` would set the separator to colons.
+ (It is not possible set this on a per-buffer basis.)
+- The types of brackets that the text object handles can currently only be
+ overridden by modifying the script itself.
## Examples
@@ -43,16 +59,15 @@ If the cursor is on the `R` in the above function call, then `daa` results in
## Installation
-Assuming you are using the
-[Pathogen plugin](https://github.com/tpope/vim-pathogen),
-just clone this repository in your `~/.vim/bundle` folder like so:
+Assuming you are using the [Pathogen plugin][pathogen], just clone this
+repository in your `~/.vim/bundle` folder like so:
```
$ cd ~/.vim/bundle
$ git clone https://github.com/b4winckler/vim-angry.git
```
-Alternatively, you can just put the `angry.vim` script in your
+Alternatively, you can just put the [`angry.vim` script][plugin] in your
`~/.vim/plugin` folder (create the folder if it does not already exist).
@@ -70,3 +85,6 @@ Alternatively, you can just put the `angry.vim` script in your
Copyright 2012 Björn Winckler. Distributed under the same license as Vim
itself. See `:h license`.
+
+[plugin]: https://github.com/b4winckler/vim-angry/blob/master/plugin/angry.vim
+[pathogen]: https://github.com/tpope/vim-pathogen

0 comments on commit 1a2af25

Please sign in to comment.