Merge pull request #3 from reedes/wordy-ring

Supports a ring of dictionaries for rapid cycling
This commit is contained in:
Reed Esau
2014-03-12 01:50:02 -06:00
3 changed files with 100 additions and 43 deletions

View File

@@ -15,6 +15,7 @@
* Includes 16 dictionaries covering different types of word usage * Includes 16 dictionaries covering different types of word usage
* Buffer-scoped configuration (leaves your global settings alone) * Buffer-scoped configuration (leaves your global settings alone)
* Unicode-friendly, including support for typographic quotes * Unicode-friendly, including support for typographic quotes
* Supports a user-configurable ring of dictionaries
## What is _wordy_? ## What is _wordy_?
@@ -55,6 +56,8 @@ package manager.
## Configuration ## Configuration
### On demand
Youll typically use this plugin on-demand. It does not require any Youll typically use this plugin on-demand. It does not require any
special configuration. special configuration.
@@ -74,6 +77,37 @@ Press ENTER or type command to continue
As instructed, press the enter key and it will disturb you no longer, at As instructed, press the enter key and it will disturb you no longer, at
least until _wordy_ feels the urge to build again. least until _wordy_ feels the urge to build again.
### Ring
Define your own ring of dictionaries, overriding the default one in your
`.vimrc`:
```
let g:wordy#ring = [
\ 'weak',
\ ['being', 'passive-voice', ],
\ 'business-jargon',
\ 'weasel',
\ 'puffery',
\ ['problematic', 'redundant', ],
\ ['colloquial', 'idiomatic', 'similies', ],
\ ]
```
You can navigate the ring with the following commands:
```
:NextWordy
:PrevWordy
```
Optionally create a key map in your `.vimrc` to rapidly cycle through the
ring:
```
nnoremap <silent> K :NextWordy<cr>
```
## Using _wordy_ ## Using _wordy_
Youll use the commands that follow to enable _wordy_. To disable it and Youll use the commands that follow to enable _wordy_. To disable it and
@@ -92,7 +126,7 @@ go to those words flagged by _wordy_.
### Weak and lazy usage ### Weak and lazy usage
``` ```
:WeakWordy :WeakWordy (weak)
``` ```
Weak and lazy words are common in first drafts. Weak and lazy words are common in first drafts.
@@ -120,8 +154,8 @@ asking whether it detracts from the point you are trying to make.
### Redundant and problematic usage ### Redundant and problematic usage
``` ```
:WordyWordy :WordyWordy (redundant)
:ProblemWordy :ProblemWordy (problematic)
``` ```
Did you ever receive an advance warning when a mere warning would do? Did you ever receive an advance warning when a mere warning would do?
@@ -138,15 +172,16 @@ targeted by _ProblemWordy_.
[1]: http://www.dailywritingtips.com/50-problem-words-and-phrases/ [1]: http://www.dailywritingtips.com/50-problem-words-and-phrases/
### Puffery and Jargonese ### Puffery and Jargon
> “The man embodies _authenticity_; his _disruptive_ ideas on > “The man embodies _authenticity_; his _disruptive_ ideas on
> _self-actualization_ reflect his _dynamic_ and _transformative_ > _self-actualization_ reflect his _dynamic_ and _transformative_
> personality.” (puffery and jargonese) > personality.” (puffery and jargon)
``` ```
:PuffWordy :PuffWordy (puffery)
:JargonWordy :JargonWordy (business-jargon)
:ArtJargonWordy (art-jargon)
``` ```
Instead of puffery, demonstrate through details. Instead of puffery, demonstrate through details.
@@ -158,7 +193,7 @@ Instead of puffery, demonstrate through details.
### Manipulative language ### Manipulative language
``` ```
:WeaselWordy :WeaselWordy (weasel)
``` ```
Words can be used to hide or obscure a weak position, or to cast doubt on Words can be used to hide or obscure a weak position, or to cast doubt on
@@ -175,8 +210,8 @@ will seek to purge such loaded language from your writing.
### To be and the passive voice ### To be and the passive voice
``` ```
:BeingWordy :BeingWordy (being)
:PassiveWordy (includes BeingWordy) :PassiveWordy (being, passive-voice)
``` ```
You may find this dictionary useful in avoiding overuse of the many forms You may find this dictionary useful in avoiding overuse of the many forms
@@ -185,7 +220,7 @@ of the verb to be, often found in overly-passive sentences.
### Colloquialisms, Idioms, and Similies ### Colloquialisms, Idioms, and Similies
``` ```
:TriteWordy :TriteWordy (colloquial, idiomatic, similies)
``` ```
Dictionaries for uncovering the tired cliché, including colloquial and Dictionaries for uncovering the tired cliché, including colloquial and
@@ -194,10 +229,10 @@ idiomatic phrases scraped from Wiktionary and Wikipedia.
### Miscellaneous ### Miscellaneous
``` ```
:SaidWordy :SaidWordy (said-synonyms)
:OpineWordy :OpineWordy (opinion)
:AintWordy :AintWordy (contractions)
:VagueTimeWordy (renamed from TimeWordy) :VagueTimeWordy (vague-time)
``` ```
A few dictionaries to serve specific needs. A few dictionaries to serve specific needs.

View File

@@ -22,7 +22,8 @@ function! wordy#init(...) abort
endif endif
" switch to usage dictionaries, building if needed " switch to usage dictionaries, building if needed
let l:dicts = get(l:args, 'd', []) let l:d = get(l:args, 'd', []) " may be string or list
let l:dicts = (type(l:d) == type([])) ? l:d : [l:d]
if len(l:dicts) if len(l:dicts)
let l:dst_paths = [] let l:dst_paths = []
" TODO &spelllang) " TODO &spelllang)
@@ -58,7 +59,25 @@ function! wordy#init(...) abort
exe 'setlocal spelllang=' . l:lang . ',' . join(l:dst_paths, ',') exe 'setlocal spelllang=' . l:lang . ',' . join(l:dst_paths, ',')
setlocal spell setlocal spell
endif endif
echohl ModeMsg | echo 'wordy: ' . join(l:dicts, ', ') | echohl NONE
endif endif
endfunction endfunction
function! wordy#jump(mode)
" mode=1 next in ring
" mode=-1 prev in ring
let l:avail_count = len(g:wordy#ring)
if l:avail_count == 0 | return | endif
if g:wordy_ring_index < 0
" ring navigation not initialized; start at begin or end
let g:wordy_ring_index =
\ a:mode == 1
\ ? 0
\ : (l:avail_count - 1)
else
let g:wordy_ring_index = (g:wordy_ring_index + a:mode) % l:avail_count
endif
call wordy#init({ 'd': g:wordy#ring[ g:wordy_ring_index ]})
endfunction
" vim:ts=2:sw=2:sts=2 " vim:ts=2:sw=2:sts=2

View File

@@ -18,42 +18,45 @@ let g:wordy_dir = fnamemodify(resolve(expand('<sfile>:p')), ':h:h')
command -nargs=0 NoWordy call wordy#init({}) command -nargs=0 NoWordy call wordy#init({})
command -nargs=0 BeingWordy call wordy#init({ 'd': ['being',] }) command -nargs=0 BeingWordy call wordy#init({ 'd': 'being' })
command -nargs=0 PassiveWordy call wordy#init({ 'd': ['passive-voice', 'being',] }) command -nargs=0 PassiveWordy call wordy#init({ 'd': ['passive-voice', 'being',] })
command -nargs=0 WeakWordy call wordy#init({ 'd': ['weak',] }) command -nargs=0 WeakWordy call wordy#init({ 'd': 'weak' })
command -nargs=0 LazyWordy call wordy#init({ 'd': ['weak',] }) command -nargs=0 LazyWordy call wordy#init({ 'd': 'weak' })
command -nargs=0 ProblemWordy call wordy#init({ 'd': ['problematic',] }) command -nargs=0 ProblemWordy call wordy#init({ 'd': 'problematic' })
command -nargs=0 WordyWordy call wordy#init({ 'd': ['redundant',] }) command -nargs=0 WordyWordy call wordy#init({ 'd': 'redundant' })
command -nargs=0 JargonWordy call wordy#init({ 'd': ['business-jargon', 'art-jargon',] }) command -nargs=0 JargonWordy call wordy#init({ 'd': 'business-jargon' })
command -nargs=0 PuffWordy call wordy#init({ 'd': ['puffery',] }) command -nargs=0 ArtJargonWordy call wordy#init({ 'd': 'art-jargon' })
command -nargs=0 WeaselWordy call wordy#init({ 'd': ['weasel',] }) command -nargs=0 PuffWordy call wordy#init({ 'd': 'puffery' })
command -nargs=0 WeaselWordy call wordy#init({ 'd': 'weasel' })
command -nargs=0 TriteWordy call wordy#init({ 'd': ['colloquial', 'idiomatic', 'similies',] }) command -nargs=0 TriteWordy call wordy#init({ 'd': ['colloquial', 'idiomatic', 'similies',] })
" tools for formal and objective writing " tools for formal and objective writing
command -nargs=0 VagueTimeWordy call wordy#init({ 'd': ['vague-time',] }) command -nargs=0 VagueTimeWordy call wordy#init({ 'd': 'vague-time' })
command -nargs=0 OpineWordy call wordy#init({ 'd': ['opinion',] }) command -nargs=0 OpineWordy call wordy#init({ 'd': 'opinion' })
command -nargs=0 SaidWordy call wordy#init({ 'd': ['said-synonyms',] }) command -nargs=0 SaidWordy call wordy#init({ 'd': 'said-synonyms' })
command -nargs=0 AintWordy call wordy#init({ 'd': ['contractions',] }) command -nargs=0 AintWordy call wordy#init({ 'd': 'contractions' })
" tools for creative writing command -nargs=0 NextWordy call wordy#jump(1)
command -nargs=0 CreativeWordy call wordy#init({ 'd': [ 'being', command -nargs=0 PrevWordy call wordy#jump(-1)
\ 'colloquial',
\ 'idiomatic', let g:wordy_ring_index = -1 " start at beginning
\ 'business-jargon',
\ 'art-jargon', " user configurable ring of dictionaries
\ 'weasel', if !exists('g:wordy#ring')
\ 'opinion', let g:wordy#ring = [
\ 'passive-voice',
\ 'puffery',
\ 'redundant',
\ 'similies',
\ 'weak', \ 'weak',
\ ]}) \ ['being', 'passive-voice', ],
\ 'business-jargon',
\ 'weasel',
\ 'puffery',
\ ['problematic', 'redundant', ],
\ ['colloquial', 'idiomatic', 'similies', ],
\ ]
endif
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo