Updating docs to reflect new features
This commit is contained in:
parent
bf3da537eb
commit
4057c955bc
108
README.md
108
README.md
@ -27,14 +27,17 @@ All operations are easily reversible and correctly preserve the indentation of t
|
|||||||
|
|
||||||
## Configuration ##
|
## Configuration ##
|
||||||
|
|
||||||
You can customize the behavior of this extension by setting values for any of the following optional buffer and global
|
You can customize the behavior of this extension by setting values for any of the following optional *buffer* and
|
||||||
variables in your `.vimrc` file:
|
*global* configuration variables in your `.vimrc` file. Buffer variables (prefixed with `b:`) take precedence over
|
||||||
|
global variables (prefixed with `g:`), making them ideal for configuring the behavior of this extension on a file by
|
||||||
|
file basis using `ftplugin` or `autocmd`. For example, the `argwrap_tail_comma` variable has two variants declared as
|
||||||
|
`b:argwrap_tail_comma` and `g:argwrap_tail_comma`, for buffer and global scopes respectively.
|
||||||
|
|
||||||
* `g:argwrap_wrap_closing_brace` or `b:argwrap_wrap_closing_brace`
|
* **argwrap_line_prefix**
|
||||||
|
|
||||||
*Specifies if the closing brace should be wrapped to a new line.*
|
Specifies a line prefix to be added and removed when working with languages that require newlines to be escaped.
|
||||||
|
|
||||||
Brace wrapping enabled (default)
|
*Line prefix disabled (default)*
|
||||||
|
|
||||||
```
|
```
|
||||||
Foo(
|
Foo(
|
||||||
@ -44,7 +47,75 @@ variables in your `.vimrc` file:
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Brace wrapping disabled (`let g:argwrap_wrap_closing_brace = 0`)
|
*Line prefix enabled for Vimscript (`let g:argwrap_line_prefix = '\'`)*
|
||||||
|
|
||||||
|
```
|
||||||
|
Foo(
|
||||||
|
\wibble,
|
||||||
|
\wobble,
|
||||||
|
\wubble
|
||||||
|
\)
|
||||||
|
```
|
||||||
|
|
||||||
|
* **argwrap_padded_braces**
|
||||||
|
|
||||||
|
Specifies which brace types should be padded on the inside with spaces.
|
||||||
|
|
||||||
|
*Brace padding disabled (default)*
|
||||||
|
|
||||||
|
```
|
||||||
|
[1, 2, 3]
|
||||||
|
{1, 2, 3}
|
||||||
|
```
|
||||||
|
|
||||||
|
*Brace padding enabled for square brackets only (`let g:argwrap_padded_braces = '['`)*
|
||||||
|
|
||||||
|
```
|
||||||
|
[ 1, 2, 3 ]
|
||||||
|
{1, 2, 3}
|
||||||
|
```
|
||||||
|
|
||||||
|
*Padding can be specified for multiple brace types (`let g:argwrap_padded_braces = '[{'`)*
|
||||||
|
|
||||||
|
* **argwrap_tail_comma**
|
||||||
|
|
||||||
|
Specifies if the closing brace should be preceded with a comma when wrapping lines.
|
||||||
|
|
||||||
|
*Tail comma disabled (default)*
|
||||||
|
|
||||||
|
```
|
||||||
|
Foo(
|
||||||
|
wibble,
|
||||||
|
wobble,
|
||||||
|
wubble
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
*Tail comma enabled (`let g:argwrap_tail_comma = 1`)*
|
||||||
|
|
||||||
|
```
|
||||||
|
Foo(
|
||||||
|
wibble,
|
||||||
|
wobble,
|
||||||
|
wubble,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
* **argwrap_wrap_closing_brace**
|
||||||
|
|
||||||
|
Specifies if the closing brace should be wrapped to a new line.
|
||||||
|
|
||||||
|
*Brace wrapping enabled (default)*
|
||||||
|
|
||||||
|
```
|
||||||
|
Foo(
|
||||||
|
wibble,
|
||||||
|
wobble,
|
||||||
|
wubble
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
*Brace wrapping disabled (`let g:argwrap_wrap_closing_brace = 0`)*
|
||||||
|
|
||||||
```
|
```
|
||||||
Foo(
|
Foo(
|
||||||
@ -53,35 +124,10 @@ variables in your `.vimrc` file:
|
|||||||
wubble)
|
wubble)
|
||||||
```
|
```
|
||||||
|
|
||||||
* `g:argwrap_padded_braces` or `b:argwrap_wrap_closing_brace`
|
|
||||||
|
|
||||||
*Specifies which brace types should be padded on the inside with spaces.*
|
|
||||||
|
|
||||||
`''`: do not add padding for any braces (empty string):
|
|
||||||
|
|
||||||
```
|
|
||||||
[1, 2, 3]
|
|
||||||
{1, 2, 3}
|
|
||||||
```
|
|
||||||
|
|
||||||
`'['`: padding for square braces only (curly braces are not padded):
|
|
||||||
|
|
||||||
```
|
|
||||||
[ 1, 2, 3 ]
|
|
||||||
{1, 2, 3}
|
|
||||||
```
|
|
||||||
|
|
||||||
Padding can be specified for multiple brace types as follows:
|
|
||||||
|
|
||||||
```
|
|
||||||
let g:argwrap_padded_braces = '[{'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage ##
|
## Usage ##
|
||||||
|
|
||||||
1. Position the cursor *inside* of the scope of the parenthesis, brackets or curly braces you wish to wrap/unwrap (not
|
1. Position the cursor *inside* of the scope of the parenthesis, brackets or curly braces you wish to wrap/unwrap (not
|
||||||
on top, before or after them).
|
on top, before or after them).
|
||||||
|
|
||||||
2. Execute the keyboard binding you defined above to *toggle* the wrapping and unwrapping of arguments.
|
2. Execute the keyboard binding you defined above to *toggle* the wrapping and unwrapping of arguments.
|
||||||
|
|
||||||
## License ##
|
## License ##
|
||||||
|
@ -209,10 +209,10 @@ endfunction
|
|||||||
function! argwrap#toggle()
|
function! argwrap#toggle()
|
||||||
let l:cursor = getpos('.')
|
let l:cursor = getpos('.')
|
||||||
|
|
||||||
|
let l:linePrefix = argwrap#getSetting('line_prefix', '')
|
||||||
|
let l:padded = argwrap#getSetting('padded_braces', '')
|
||||||
let l:tailComma = argwrap#getSetting('tail_comma', 0)
|
let l:tailComma = argwrap#getSetting('tail_comma', 0)
|
||||||
let l:wrapBrace = argwrap#getSetting('wrap_closing_brace', 1)
|
let l:wrapBrace = argwrap#getSetting('wrap_closing_brace', 1)
|
||||||
let l:padded = argwrap#getSetting('padded_braces', '')
|
|
||||||
let l:linePrefix = argwrap#getSetting('line_prefix', '')
|
|
||||||
|
|
||||||
let l:range = argwrap#findClosestRange()
|
let l:range = argwrap#findClosestRange()
|
||||||
if !argwrap#validateRange(l:range)
|
if !argwrap#validateRange(l:range)
|
||||||
|
@ -5,8 +5,9 @@ CONTENTS
|
|||||||
|
|
||||||
1. ArgWrap...............................................................................................|argwrap-argwrap|
|
1. ArgWrap...............................................................................................|argwrap-argwrap|
|
||||||
1.1. Installation...............................................................................|argwrap-installation|
|
1.1. Installation...............................................................................|argwrap-installation|
|
||||||
1.2. Usage.............................................................................................|argwrap-usage|
|
1.2. Configuration.............................................................................|argwrap-configuration|
|
||||||
1.3. Configuration.............................................................................|argwrap-configuration|
|
1.3. Usage.............................................................................................|argwrap-usage|
|
||||||
|
1.4. License.........................................................................................|argwrap-license|
|
||||||
|
|
||||||
========================================================================================================================
|
========================================================================================================================
|
||||||
ARGWRAP *argwrap-argwrap*
|
ARGWRAP *argwrap-argwrap*
|
||||||
@ -32,20 +33,65 @@ INSTALLATION
|
|||||||
nnoremap <silent> <leader>a :ArgWrap<CR>
|
nnoremap <silent> <leader>a :ArgWrap<CR>
|
||||||
<
|
<
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
|
||||||
USAGE *argwrap-usage*
|
|
||||||
|
|
||||||
1. Position the cursor inside of the scope of the parenthesis, brackets or curly braces you wish to wrap/unwrap (not
|
|
||||||
on top, before or after them).
|
|
||||||
2. Execute the keyboard binding you defined above to toggle the wrapping and unwrapping of arguments.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
CONFIGURATION *argwrap-configuration*
|
CONFIGURATION *argwrap-configuration*
|
||||||
|
|
||||||
You can customize the behavior of this extension by setting values for any of the following optional buffer and global
|
You can customize the behavior of this extension by setting values for any of the following optional buffer and
|
||||||
variables in your `.vimrc` file:
|
global configuration variables in your `.vimrc` file. Buffer variables (prefixed with `b:`) take precedence over
|
||||||
|
global variables (prefixed with `g:`), making them ideal for configuring the behavior of this extension on a file by
|
||||||
|
file basis using `ftplugin` or `autocmd`. For example, the `argwrap_tail_comma` variable has two variants declared as
|
||||||
|
`b:argwrap_tail_comma` and `g:argwrap_tail_comma`, for buffer and global scopes respectively.
|
||||||
|
|
||||||
* `g:argwrap_wrap_closing_brace` or `b:argwrap_wrap_closing_brace`
|
* argwrap_line_prefix
|
||||||
|
Specifies a line prefix to be added and removed when working with languages that require newlines to be escaped.
|
||||||
|
Line prefix disabled (default)
|
||||||
|
>
|
||||||
|
Foo(
|
||||||
|
wibble,
|
||||||
|
wobble,
|
||||||
|
wubble
|
||||||
|
)
|
||||||
|
<
|
||||||
|
Line prefix enabled for Vimscript ()
|
||||||
|
>
|
||||||
|
Foo(
|
||||||
|
\wibble,
|
||||||
|
\wobble,
|
||||||
|
\wubble
|
||||||
|
\)
|
||||||
|
<
|
||||||
|
* argwrap_padded_braces
|
||||||
|
Specifies which brace types should be padded on the inside with spaces.
|
||||||
|
Brace padding disabled (default)
|
||||||
|
>
|
||||||
|
[1, 2, 3]
|
||||||
|
{1, 2, 3}
|
||||||
|
<
|
||||||
|
Brace padding enabled for square brackets only ()
|
||||||
|
>
|
||||||
|
[ 1, 2, 3 ]
|
||||||
|
{1, 2, 3}
|
||||||
|
<
|
||||||
|
Padding can be specified for multiple brace types ()
|
||||||
|
* argwrap_tail_comma
|
||||||
|
Specifies if the closing brace should be preceded with a comma when wrapping lines.
|
||||||
|
Tail comma disabled (default)
|
||||||
|
>
|
||||||
|
Foo(
|
||||||
|
wibble,
|
||||||
|
wobble,
|
||||||
|
wubble
|
||||||
|
)
|
||||||
|
<
|
||||||
|
Tail comma enabled ()
|
||||||
|
>
|
||||||
|
Foo(
|
||||||
|
wibble,
|
||||||
|
wobble,
|
||||||
|
wubble,
|
||||||
|
)
|
||||||
|
<
|
||||||
|
* argwrap_wrap_closing_brace
|
||||||
Specifies if the closing brace should be wrapped to a new line.
|
Specifies if the closing brace should be wrapped to a new line.
|
||||||
Brace wrapping enabled (default)
|
Brace wrapping enabled (default)
|
||||||
>
|
>
|
||||||
@ -62,19 +108,15 @@ variables in your `.vimrc` file:
|
|||||||
wobble,
|
wobble,
|
||||||
wubble)
|
wubble)
|
||||||
<
|
<
|
||||||
* `g:argwrap_padded_braces` or `b:argwrap_wrap_closing_brace`
|
|
||||||
Specifies which brace types should be padded on the inside with spaces.
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
`''`: do not add padding for any braces (empty string):
|
USAGE *argwrap-usage*
|
||||||
>
|
|
||||||
[1, 2, 3]
|
1. Position the cursor inside of the scope of the parenthesis, brackets or curly braces you wish to wrap/unwrap (not
|
||||||
{1, 2, 3}
|
on top, before or after them).
|
||||||
<
|
2. Execute the keyboard binding you defined above to toggle the wrapping and unwrapping of arguments.
|
||||||
`'['`: padding for square braces only (curly braces are not padded):
|
|
||||||
>
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
[ 1, 2, 3 ]
|
LICENSE *argwrap-license*
|
||||||
{1, 2, 3}
|
|
||||||
<
|
MIT
|
||||||
Padding can be specified for multiple brace types as follows:
|
|
||||||
>
|
|
||||||
let g:argwrap_padded_braces = '[{'
|
|
||||||
<
|
|
||||||
|
Loading…
Reference in New Issue
Block a user