Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/space.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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|

Expand Down
35 changes: 35 additions & 0 deletions plugin/space.vim
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
" Disable <Space> for searches, e.g. /?#*nN
" let g:space_no_search = 1
"
" Disable <Space> for spelling movement commands, e.g. [s, ]s, [S and ]S
" let g:space_no_spell = 1
"
" Disable <Space> for jump commands, e.g. Ctrl-O, Ctrl-I, g, and g;
" let g:space_no_jump = 1
"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <expr> <silent> ]s <SID>setup_space("spell_next", "]s")
noremap <expr> <silent> [s <SID>setup_space("spell_next", "[s")

noremap <expr> <silent> ]S <SID>setup_space("rare_next", "]S")
noremap <expr> <silent> [S <SID>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
Expand Down Expand Up @@ -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 <C-o>
Expand Down Expand Up @@ -486,6 +511,16 @@ function! s:setup_space(type, command)
let s:shift_space_move = "N"
let s:cmd_type = "search"
let cmd = <SID>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 = <SID>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 = <SID>maybe_open_fold(cmd)
elseif a:type == "cjump"
let s:space_move = "g,"
let s:shift_space_move = "g;"
Expand Down
12 changes: 12 additions & 0 deletions test/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
+ [[
+ ][
+ []
+ ]s
+ [s
+ ]S
+ [S

= Test visual mode mappings
+ f
Expand Down Expand Up @@ -103,6 +107,10 @@
+ [[
+ ][
+ []
+ ]s
+ [s
+ ]S
+ [S

= Test quickfix and location list commands
+ :cc
Expand Down Expand Up @@ -144,6 +152,10 @@
/ ? search
+ n search
+ N search
+ ]s search
+ [s search
+ ]S search
+ [S search
+ ]) block
+ [( block
+ ]} block
Expand Down