From 4d6ce665061b24542ad26de7ca09640637d9f9ef Mon Sep 17 00:00:00 2001 From: Will Gray Date: Tue, 23 Oct 2012 14:39:25 -0500 Subject: [PATCH 1/2] Add spelling movements Resolves spiiph/vim-space#17 --- plugin/space.vim | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/plugin/space.vim b/plugin/space.vim index de13790..8bcf56e 100755 --- a/plugin/space.vim +++ b/plugin/space.vim @@ -31,6 +31,9 @@ " Disable for searches, e.g. /?#*nN " let g:space_no_search = 1 " +" Disable for spelling movement commands, e.g. [s, ]s, [S and ]S +" let g:space_no_spell = 1 +" " Disable for jump commands, e.g. Ctrl-O, Ctrl-I, g, and g; " let g:space_no_jump = 1 " @@ -76,6 +79,7 @@ if exists("g:space_debug") let g:space_no_character_movements = 0 let g:space_no_search = 0 + let g:space_no_spell = 0 let g:space_no_jump = 0 let g:space_no_diff = 0 let g:space_no_brace = 0 @@ -170,6 +174,22 @@ else let s:search_mappings = 0 endif +" previous/next spelling error +if !exists("g:space_no_spell") || !g:space_no_spell + noremap ]s setup_space("spell_next", "]s") + noremap [s setup_space("spell_next", "[s") + + noremap ]S setup_space("rare_next", "]S") + noremap [S setup_space("rare_next", "[S") + + if exists("g:space_disable_select_mode") + silent! sunmap ]s + silent! sunmap [s + silent! sunmap ]S + silent! sunmap [S + endif +endif + " jump commands " NOTE: Jumps are not motions. They can't be used in Visual mode. if !exists("g:space_no_jump") || !g:space_no_jump @@ -308,6 +328,11 @@ function! s:remove_space_mappings() silent! unmap n silent! unmap N + silent! unmap ]s + silent! unmap [s + silent! unmap ]S + silent! unmap [S + silent! nunmap g, silent! nunmap g; silent! nunmap @@ -486,6 +511,16 @@ function! s:setup_space(type, command) let s:shift_space_move = "N" let s:cmd_type = "search" let cmd = maybe_open_fold(cmd) + elseif a:type == "spell_next" + let s:space_move = "]s" + let s:shift_space_move = "[s" + let s:cmd_type = "search" + let cmd = maybe_open_fold(cmd) + elseif a:type == "rare_next" + let s:space_move = "]S" + let s:shift_space_move = "[S" + let s:cmd_type = "search" + let cmd = maybe_open_fold(cmd) elseif a:type == "cjump" let s:space_move = "g," let s:shift_space_move = "g;" From e7714fa31934fd9d13c51e56dacc862c0e286d26 Mon Sep 17 00:00:00 2001 From: Hermann Schwarting Date: Mon, 29 Oct 2012 18:46:25 +0100 Subject: [PATCH 2/2] Documentation for spelling movements ]s [s ]S [S --- doc/space.txt | 3 +++ test/tests.txt | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/doc/space.txt b/doc/space.txt index b4426b1..3a75557 100755 --- a/doc/space.txt +++ b/doc/space.txt @@ -135,6 +135,9 @@ Method jumps: |various-motions| Section jumps: |object-motions| |]]| |[]| |][| |[[| +Spelling jumps: |spell-quickstart| + |]s| |[s| |]S| |[S| + Fold movements: |zj| |zk| |]z| |[z| diff --git a/test/tests.txt b/test/tests.txt index 90665f2..a4ac842 100644 --- a/test/tests.txt +++ b/test/tests.txt @@ -73,6 +73,10 @@ + [[ + ][ + [] + + ]s + + [s + + ]S + + [S = Test visual mode mappings + f @@ -103,6 +107,10 @@ + [[ + ][ + [] + + ]s + + [s + + ]S + + [S = Test quickfix and location list commands + :cc @@ -144,6 +152,10 @@ / ? search + n search + N search + + ]s search + + [s search + + ]S search + + [S search + ]) block + [( block + ]} block