diff options
author | Teddy Wing | 2016-08-28 16:48:10 -0400 |
---|---|---|
committer | Teddy Wing | 2016-08-28 16:48:10 -0400 |
commit | 5504e15411b0f682f3415677e65cbf03d6339d50 (patch) | |
tree | a08920dd5388f57ada07b1b9917d5f1321ccc16d /bundle/spellcycle/autoload | |
parent | d3c0a50477970bb8bd560d499fcf12305b4a7892 (diff) | |
download | dotvim-5504e15411b0f682f3415677e65cbf03d6339d50.tar.bz2 |
First version of 'spellcycle' plugin
A new plugin that cycles through a list of languages to use when spell
checking. Using a couple of mappings, we can quickly change the
`spelllang` to the language we want to write or read in.
Languages are currently set to English and French, since those are the
two that I use. The mappings are bound to `[l` and `]l` (in
unimpaired.vim style) since those didn't seem to be used by anything.
Diffstat (limited to 'bundle/spellcycle/autoload')
-rw-r--r-- | bundle/spellcycle/autoload/spellcycle.vim | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bundle/spellcycle/autoload/spellcycle.vim b/bundle/spellcycle/autoload/spellcycle.vim new file mode 100644 index 0000000..6f4b703 --- /dev/null +++ b/bundle/spellcycle/autoload/spellcycle.vim @@ -0,0 +1,16 @@ +" Cycle +" Cycle the 'spelllang' option through a set of languages. The `direction` +" argument specifies whether to move left or right (and how much to move) in +" the list. +" +" Derived from `CycleLang` as written by kev here: +" http://stackoverflow.com/questions/12006508/vim-how-to-cycle-through-a-list-of-options-using-the-same-key/12006781#12006781 +function! spellcycle#Cycle(direction) + let languages = ['en', 'fr'] + + let i = index(languages, &spelllang) + let cycled_index = (i + a:direction) % len(languages) + let &spelllang = languages[cycled_index] + + set spelllang? +endfunction |