1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 02:30:05 +08:00
SpaceVim/bundle/incsearch.vim/test/lastpattern.vimspec
Wang Shidong cd6ea298f2
fix java neoformat config
* Add incsearch.vim into bundle dir

* Fix java neoformat config

close #3573

* Use echom instead in pull.vim
2020-06-13 21:58:05 +08:00

66 lines
1.5 KiB
Plaintext
Vendored

Describe lastpattern
" :h last-pattern
let s:lines = ['1pattern_a', '2pattern_b', '3pattern_c', '4pattern_d', '5pattern_e']
function! s:reset_buffer()
:1,$ delete
call AddLines(s:lines)
normal! Gddgg0zt
endfunction
Before all
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
call s:reset_buffer()
End
Before each
:1
normal! zt
End
After all
:1,$ delete
unmap /
unmap ?
unmap g/
let @/ = ''
let g:incsearch#magic = ''
End
Context handle last-pattern
It should handle empty pattern as last-pattern
let @/ = s:lines[1]
exec "normal" "/\<CR>"
Assert Equals(line('.'), 2)
Assert Equals(GetPosChar(), '2')
End
It should handle empty pattern with {offset} as last-pattern
let @/ = s:lines[1]
exec "normal" "//e\<CR>"
Assert Equals(line('.'), '2')
Assert Equals(GetPosChar(), 'b')
End
End
Context handle last-pattern with improved magic option
It should handle empty pattern as last-pattern
let g:incsearch#magic = '\v'
let @/ = s:lines[1]
exec "normal" "/\<CR>"
Assert Equals(line('.'), 2)
Assert Equals(GetPosChar(), '2')
End
It should handle empty pattern with {offset} as last-pattern
let g:incsearch#magic = '\v'
let @/ = s:lines[1]
exec "normal" "//e\<CR>"
Assert Equals(line('.'), '2')
Assert Equals(GetPosChar(), 'b')
End
End
End