Skip to content

Commit

Permalink
Remove all of the example configurations. #62
Browse files Browse the repository at this point in the history
They were more confusing than helpful.
  • Loading branch information
chaoren committed Apr 23, 2022
1 parent 61b8337 commit a7ba92d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 163 deletions.
114 changes: 24 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,113 +52,47 @@ Default `word`/`WORD` mappings:
| `xo` | `iw`/`iW` |
| `c` | `<C-R><C-W>`/`<C-R><C-A>` |

### `g:wordmotion_nomap`

Use `g:wordmotion_nomap` to get `<Plug>` mappings only. \
E.g.,

```vim
let g:wordmotion_nomap = 1
nmap w <Plug>WordMotion_w
nmap b <Plug>WordMotion_b
nmap gE <Plug>WordMotion_gE
omap aW <Plug>WordMotion_aW
cmap <C-R><C-W> <Plug>WordMotion_<C-R><C-W>
```
You do **NOT** need any of the mapping customizations below if the default
mappings already work for you.

### `g:wordmotion_prefix`

Use `g:wordmotion_prefix` to apply a common prefix to each of the default word
motion mappings. \
E.g.,

```vim
let g:wordmotion_prefix = '<Leader>'
```

NOTE: does not apply to the `<C-R><C-W>` and `<C-R><C-A>` mappings. \
NOTE: no effect if `g:wordmotion_nomap` is enabled.
motion mappings.

### `g:wordmotion_mappings`

Use `g:wordmotion_mappings` to individually replace the default word motion
mappings. \
E.g.,
mappings. `g:wordmotion_mappings` is a dictionary where the keys are the default
mappings and the values are the mappings that you want to replace them with.
Unspecified entries will still use the default mappings. Entries set to an empty
string will be disabled.

```vim
let g:wordmotion_mappings = {
\ 'w' : '<M-w>',
\ 'b' : '<M-b>',
\ 'e' : '<M-e>',
\ 'ge' : 'g<M-e>',
\ 'aw' : 'a<M-w>',
\ 'iw' : 'i<M-w>',
\ '<C-R><C-W>' : '<C-R><M-w>'
\ }
```
### `g:wordmotion_nomap`

Unspecified entries will still use the default mappings. \
Set the value to an empty string to disable the mapping. \
NOTE: this overrides `g:wordmotion_prefix`. \
NOTE: no effect if `g:wordmotion_nomap` is enabled.
Use `g:wordmotion_nomap` to disable all of the default mappings. You can create
your own mappings to the `<Plug>WordMotion_` internal mappings. Since there are
multiple modes involved for many of the mappings, it's probably more convenient
to use `g:wordmotion_prefix` or `g:wordmotion_mappings`.

### `g:wordmotion_spaces`

Use `g:wordmotion_spaces` to designate extra space character patterns. \
E.g.,

```vim
let g:wordmotion_spaces = ['\w\@<=-\w\@=', '\.']
```

will produce the following result:

```
3. - foo-bar.baz
w->w>w-->w-->w>w
```
Use `g:wordmotion_spaces` to designate extra space characters.
`g:wordmotion_spaces` is a list where each item is a regular expression for
a character that you want to treat as a space. You have to make sure the regex
matches a single character. You can use lookaheads and lookbehinds for
context-sensitive space characters.

NOTE: make sure the regex matches a single character. You can use lookaheads and
lookbehinds for context-sensitive space characters. \
NOTE: the default patterns match 1) hyphens (`-`) between between alphabetic
characters and 2) underscores (`_`) between alphanumeric characters.
By default, these are treated as spaces in addition to the actual space
characters:
1. hyphens (`-`) between between alphabetic characters
2. underscores (`_`) between alphanumeric characters

### `g:wordmotion_uppercase_spaces`

Use `g:wordmotion_uppercase_spaces` (default empty) to designate extra space
character patterns for uppercase motions. \
E.g.,

```vim
let g:wordmotion_uppercase_spaces = ['-']
```

will produce the following result:

```
foo_bar-baz.qux
W------>W---->W
```

NOTE: if `g:wordmotion_uppercase_spaces` is not set there will not be any
mappings for uppercase motions.

### `wordmotion#reload()`

All options can be updated by reloading the plugin. \
E.g., to disable the `w` mapping:

```vim
let g:wordmotion_mappings['w'] = ''
call wordmotion#reload()
```

then later re-enable it

```vim
let g:wordmotion_mappings['w'] = '<M-w>'
call wordmotion#reload()
```
Use `g:wordmotion_uppercase_spaces` to designate extra space characters for
uppercase motions. These are separate from `g:wordmotion_spaces`. There are
no extra space characters for uppercase motions by default.

## Notable Changes

Expand Down
96 changes: 23 additions & 73 deletions doc/wordmotion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,88 +101,38 @@ Default `word` mappings are `w`, `b`, `e`, `ge`, `aw`, `iw`, and `<C-R><C-W>`.

Default `WORD` mappings are `W`, `B`, `E`, `gE`, `aW`, `iW`, and `<C-R><C-A>`.

*g:wordmotion_nomap*
Use `g:wordmotion_nomap` to get `<Plug>` mappings only.
E.g.,
>
let g:wordmotion_nomap = 1
nmap w <Plug>WordMotion_w
nmap b <Plug>WordMotion_b
nmap gE <Plug>WordMotion_gE
omap aW <Plug>WordMotion_aW
cmap <C-R><C-W> <Plug>WordMotion_<C-R><C-W>
<
*g:wordmotion_prefix*
Use |g:wordmotion_prefix| to apply a common prefix to each of the default word
motion mappings.
E.g.,
>
let g:wordmotion_prefix = '<Leader>'
<
NOTE: does not apply to the `<C-R><C-W>` and `<C-R><C-A>` mappings.
NOTE: no effect if `g:wordmotion_nomap` is enabled.

*g:wordmotion_mappings*
Use |g:wordmotion_mappings| to individually replace the default word motion
mappings.
E.g.,
>
let g:wordmotion_mappings = {
\ 'w' : '<M-w>',
\ 'b' : '<M-b>',
\ 'e' : '<M-e>',
\ 'ge' : 'g<M-e>',
\ 'aw' : 'a<M-w>',
\ 'iw' : 'i<M-w>',
\ '<C-R><C-W>' : '<C-R><M-w>'
\ }
<
Unspecified entries will still use the default mappings.
Set the value to an empty string to disable the mapping.
NOTE: this overrides |g:wordmotion_prefix|.
NOTE: no effect if `g:wordmotion_nomap` is enabled.
mappings. |g:wordmotion_mappings| is a dictionary where the keys are the
default mappings and the values are the mappings that you want to replace them
with. Unspecified entries will still use the default mappings. Entries set to
an empty string will be disabled.

*g:wordmotion_nomap*
Use |g:wordmotion_nomap| to disable all of the default mappings. You can
create your own mappings to the |<Plug>WordMotion_| internal mappings. Since
there are multiple modes involved for many of the mappings, it's probably more
convenient to use |g:wordmotion_prefix| or |g:wordmotion_mappings|.

*g:wordmotion_spaces*
Use |g:wordmotion_spaces| to designate extra space character patterns.
E.g.,
>
let g:wordmotion_spaces = ['\w\@<=-\w\@=', '\.']
<
will produce the following result:
>
3. - foo-bar.baz
^ ^ ^ ^ ^
<
NOTE: make sure the regex matches a single character. You can use lookaheads
and lookbehinds for context-sensitive space characters.
NOTE: the default patterns match 1) hyphens (`-`) between between alphabetic
characters and 2) underscores (`_`) between alphanumeric characters.
Use |g:wordmotion_spaces| to designate extra space characters.
|g:wordmotion_spaces| is a list where each item is a regular expression for
a character that you want to treat as a space. You have to make sure the regex
matches a single character. You can use lookaheads and lookbehinds for
context-sensitive space characters.

By default, these are treated as spaces in addition to the actual space
characters:
1. hyphens (`-`) between between alphabetic characters
2. underscores (`_`) between alphanumeric characters

*g:wordmotion_uppercase_spaces*
Use `g:wordmotion_uppercase_spaces` (default empty) to designate extra space
character patterns for uppercase motions.\
E.g.,
>
let g:wordmotion_uppercase_spaces = ['-']
<
will produce the following result:
>
foo_bar-baz.qux
^ ^
<
If `g:wordmotion_uppercase_spaces` is not set there will not be any mappings for
uppercase motions.
Use |g:wordmotion_uppercase_spaces| to designate extra space characters for
uppercase motions. These are separate from |g:wordmotion_spaces|. There are
no extra space characters for uppercase motions by default.

*wordmotion-reload*
All options can be updated by reloading the plugin.
E.g., to disable the `w` mapping:
>
let g:wordmotion_mappings['w'] = ''
call wordmotion#reload()
<
then later re-enable it
>
let g:wordmotion_mappings['w'] = '<M-w>'
call wordmotion#reload()
<
vim:tw=78:ts=8:noet:ft=help:norl:

0 comments on commit a7ba92d

Please sign in to comment.