Permalink
Fetching contributors…
Cannot retrieve contributors at this time
1131 lines (918 sloc) 24.9 KB
# vim -N -u NONE -c "set rtp+=~/.vim/bundle/vim-sneak,~/.vim/bundle/vader.vim,~/.vim/bundle/vim-repeat" -c "runtime! plugin/sneak.vim plugin/vader.vim plugin/repeat.vim" -c "Vader ~/.vim/bundle/vim-sneak/tests/test.vader"
# vim -N -u NONE -c 'set rtp+=~/.vim/bundle/vim-sneak,~/.vim/bundle/vader.vim,~/.vim/bundle/vim-repeat' -c 'runtime! plugin/sneak.vim plugin/vader.vim plugin/repeat.vim' -c 'Vader ~/.vim/bundle/vim-sneak/tests/test.vader'
#
# BUG: highlight targets are bogus if &iminsert=1
# BUG: sneak cannot find ёе: in this text
# BUG: sneak cannot find е:а in this text
#
# ёе:а
# ёе:а
# ёе:а
# ёе:а
# ёе:а
# ёе:ёе:ёе:ёе:ёе:ёе:ёе:аааааааёе:а
# ёе:ёе:ёе:ёе:ёе:ёе:ёе:аааааааёе:а
# ёе:ёе:ёе:ёе:ёе:ёе:ёе:аааааааёе:а
# ёе:ёе:ёе:ёе:ёе:ёе:ёе:аааааааёе:а
# ёе:ёе:ёе:ёе:ёе:ёе:ёе:аааааааёе:а
# ёе:ёе:ёе:ёе:ёе:ёе:ёе:аааааааёе:а
Execute (Clean up test environment):
if !has('nvim')
set encoding=utf8
scriptencoding utf8
endif
nmap ; <Plug>Sneak_;
nmap \ <Plug>Sneak_,
omap \ <Plug>Sneak_,
xmap \ <Plug>Sneak_,
silent! unmap f
silent! unmap t
let mapleader = ','
let g:sneak#label = 0
let g:sneak#use_ic_scs = 0
call sneak#init()
###########################################################
Execute (autoloaded functions should not exist):
Assert !exists("*sneak#label#to")
Assert !exists("*sneak#hl#removehl")
Assert !exists("*sneak#search#new")
Assert !exists("*sneak#util#strlen")
# this must be the first test, because it tests built-in f-repeat
# for the case where s has not ever been invoked.
Given:
ababAbABababaB
Do (f-repeat without having ever invoked s. #31):
fa;ix
Expect:
ababAbABxababaB
###########################################################
# unit tests
Do (tickle the autoloads):
sab
Execute ('label' functions should not exist after vanilla-sneak):
Assert !exists("*sneak#label#to")
Execute (hl#links_to() returns linked-to highlight group):
hi! link Conceal SneakConceal
Assert 'SneakConceal' ==# sneak#hl#links_to('Conceal')
Execute (hl#links_to() returns NONE if not linked):
hi! link Conceal NONE
Assert "NONE" ==# sneak#hl#links_to('Conceal')
Execute (hl#get() handles non-existent hl group):
Assert '' == sneak#hl#get('Derp')
Execute (hl#get() returns text definition of highlight group):
hi Cursor guifg=white guibg=#0a9dff ctermfg=16 ctermbg=253
Assert match(sneak#hl#get('Cursor'), '\Vctermbg=253')
Execute (hl#get() returns empty if highlight group is 'cleared'):
hi clear Cursor
Assert "" == sneak#hl#get('Cursor')
Execute (sneak#is_sneaking() returns 1 when activated):
norm sab
Assert sneak#is_sneaking()
Execute (sneak#cancel() cancels sneak#is_sneaking()):
norm sab
Assert sneak#is_sneaking()
call sneak#cancel()
Assert !sneak#is_sneaking()
Execute (label#sanitize_target_labels()):
runtime autoload/sneak/label.vim
let orig = g:sneak#target_labels
let g:sneak#target_labels = " \\ as d\<Esc>fo\<Tab>ob\<Space>a;\\rASD"
call sneak#label#sanitize_target_labels()
Assert g:sneak#target_labels ==# ";asdfoobarASD"
"cleanup
let g:sneak#target_labels = orig
Given:
abab
abab
Execute (s.hasmatches()):
norm! jll
let s = g:sneak#search#instance
call s.init("ab", 0, 0)
Assert !s.hasmatches(2)
Assert !s.hasmatches(1)
norm! k
Assert s.hasmatches(1)
Assert s.hasmatches(2)
Assert !s.hasmatches(3)
Execute (autoloaded functions should exist):
Assert exists("*sneak#label#to")
Assert exists("*sneak#hl#removehl")
Assert exists("*sneak#search#new")
Assert exists("*sneak#util#strlen")
###########################################################
Given:
1 22222 33 444 555 6666 7 888
11 222 3333 4 55 6666 77 888
111 22 333 444 42555 6666 7 88888
1111 2 33 444 555 66 77a 8
Do (move to 22):
s22x
Expect:
1 2222 33 444 555 6666 7 888
11 222 3333 4 55 6666 77 888
111 22 333 444 42555 6666 7 88888
1111 2 33 444 555 66 77a 8
Do (next match):
s22;x
Expect:
1 2222 33 444 555 6666 7 888
11 222 3333 4 55 6666 77 888
111 22 333 444 42555 6666 7 88888
1111 2 33 444 555 66 77a 8
Do (skip to third match):
s\<Space>43;x
Expect:
1 22222 33 444 555 6666 7 888
11 222 3333 4 55 6666 77 888
111 22 333 44442555 6666 7 88888
1111 2 33 444 555 66 77a 8
# CursorMoved is not triggered in scripts/macros, so we must force it.
# https://github.com/junegunn/vader.vim/issues/2
Do (visual mode forwards):
vwjs42lo
:\<C-U>doautocmd CursorMoved\<CR>
:\<C-U>doautocmd CursorMoved\<CR>
gvs55;d
Expect:
1 22222 33 444 555 6666 7 888
11 222 3333 4 555 6666 7 88888
1111 2 33 444 555 66 77a 8
Do (visual mode backwards):
jjjvwwoZ33;;\d
Expect:
1 22222 33 444 555 6666 7 888
11 222 333 444 555 66 77a 8
Given:
a,,bbb
aa,,bb
aaa,,b
aaaa,,
aaa,b,
aa,bb,
a,bbb,
Do (search backwards):
jjSbbx
Expect:
a,,bbb
aa,,b
aaa,,b
aaaa,,
aaa,b,
aa,bb,
a,bbb,
###########################################################
# delete, change, yank
Given:
Paul McCartney 1942
George Harrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (delete):
dzar
Expect:
artney 1942
George Harrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (delete backwards):
jwdZar
Expect:
Paul McCHarrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (delete [count]):
d3zar
Expect:
arr 1940mm
Pete Best 1941
Do (delete ;):
dzar
:\<C-U>doautocmd CursorMoved\<CR>
d;
Expect:
arrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (change):
llczar
Expect:
Paartney 1942
George Harrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (change backwards):
jjllcZar
Expect:
Paul McCartney 1942
George Hngo Starr 1940mm
Pete Best 1941
Do (change [count]):
c3zar
Expect:
arr 1940mm
Pete Best 1941
Do (change ;):
czarfoo\<Esc>l
:\<C-U>doautocmd CursorMoved\<CR>
c;bar
Expect:
foobararrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (yank):
jlyzarp
Expect:
Paul McCartney 1942
Geeorge Horge Harrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (yank backwards):
jjllyZarp
Expect:
Paul McCartney 1942
George Haarrison 1943mmdd
Rirrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (yank [count]):
y3zarP
Expect:
Paul McCartney 1942
George Harrison 1943mmdd
Ringo StPaul McCartney 1942
George Harrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
###########################################################
# repeat-operation (.)
Given:
Paul McCartney 1942
George Harrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (search for H):
sH\<Enter>x
Expect:
Paul McCartney 1942
George arrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (repeat change):
jlczarfoo\<Esc>l
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
Paul McCartney 1942
Gfoofooarr 1940mm
Pete Best 1941
Do (repeat backwards change):
jjllcZarfoo\<Esc>hh
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
Paul McCfoofoongo Starr 1940mm
Pete Best 1941
Do (repeat delete operation):
dzar
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
arrison 1943mmdd
Ringo Starr 1940mm
Pete Best 1941
Do (repeat delete operation twice):
dzar
:\<C-U>doautocmd CursorMoved\<CR>
.
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
arr 1940mm
Pete Best 1941
Do (repeat backwards delete operation. #7):
3jdZar
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
Paul McCartney 1942
George Ht
Pete Best 1941
Do (repeat backwards delete operation twice. #7):
3jdZar
:\<C-U>doautocmd CursorMoved\<CR>
.
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
Paul McCt
Pete Best 1941
###########################################################
# [count]repeat and repeat [count]op
Given:
Paul McCartney 1942
George Harrison 1943mmdd
Ringo Starr 1940mm
Pete Babbar 1941
Do (repeat [count] delete operation):
2dzar
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
ar 1941
Do (repeat [count] delete operation):
2czarfoo\<Esc>l
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
foofooar 1941
Do ([count]repeat delete):
dzar
:\<C-U>doautocmd CursorMoved\<CR>
2.
Expect:
arr 1940mm
Pete Babbar 1941
Do ([count]repeat change):
czarfoo\<Esc>l
:\<C-U>doautocmd CursorMoved\<CR>
2.
Expect:
foofooarr 1940mm
Pete Babbar 1941
###########################################################
Given:
xyz="abc=def"
a=b#=c
\\\\ \ \ ? !--``.ago_ *$&()[]{}
Do (search for backticks, then backslashes):
llls``
:\<C-U>doautocmd CursorMoved\<CR>
:\<C-U>doautocmd CursorMoved\<CR>
S\\i:)
Expect:
xyz="abc=def"
a=b#=c
\\:)\\ \ \ ? !--``.ago_ *$&()[]{}
###########################################################
Given:
var jdbc = {
// JDBC driver for MySQL database:
driver: "com.mysql.jdbc.Driver",
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
url: 'jdbc:mysql://localhost/test',
abpa: "pass",
"pass:pass":"r00t:pa55"
};
Do (vertical scope and count-prefixed repeat-motion):
wwjl3spa2;i:
Expect:
var jdbc = {
// JDBC driver for MySQL database:
driver: "com.mysql.jdbc.Driver",
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
url: 'jdbc:mysql://localhost/test',
abpa: "pass",
"pass::pass":"r00t:pa55"
};
###########################################################
Given:
| Option | Type | Default | Description |
| -- | -- | -- | -- |
| threads | Fixnum | 1 | number of threads in the thread pool |
| queues | Fixnum | 1 | number of concurrent queues |
| queue_size | Fixnum | 1000 | size of each queue |
| interval | Numeric | 0 | dispatcher interval for batch processing |
| batch | Boolean | false | enables batch processing mode |
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
| logger | Logger | nil | logger instance for debug logs |
Do (crazy sequence with s, f, counts, and repeats):
fDs1\<Space>;\2fe2;3j4Ti\~
Expect:
| Option | Type | Default | Description |
| -- | -- | -- | -- |
| threads | Fixnum | 1 | number of threads in the thread pool |
| queues | Fixnum | 1 | number of concurrent queues |
| queue_size | Fixnum | 1000 | size of each queue |
| interval | NumeRic | 0 | dispatcher interval for batch processing |
| batch | Boolean | false | enables batch processing mode |
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
| logger | Logger | nil | logger instance for debug logs |
###########################################################
# clever-s _not_ in label-mode
Execute (init clever-s):
let g:sneak#s_next = 1
call sneak#init()
Given:
abcdef abcdef abcdef
abcdef abcdef abcdef
abcdef abcdef abcdef
Do (dummy step to work around Vim (or Vader) macro bug):
sab\<esc>u
Do (clever-s):
sabsax
Expect:
abcdef abcdef axbcdef
abcdef abcdef abcdef
abcdef abcdef abcdef
Do (clever-s):
sab3sax
Expect:
abcdef abcdef abcdef
abcdef axbcdef abcdef
abcdef abcdef abcdef
Do (clever-s):
sabsssssssSSax
Expect:
abcdef abcdef abcdef
abcdef abcdef abcdef
axbcdef abcdef abcdef
Do (clever-s with input truncated by <Enter> should still clever-repeat):
se\<Enter>sssix
Expect:
abcdef abcdef abcdef
abcdxef abcdef abcdef
abcdef abcdef abcdef
Execute (unset clever-s):
let g:sneak#s_next = 0
call sneak#init()
###########################################################
# g:sneak#absolute_dir
Given:
abcdef abcdef abcdef
abcdef abcdef abcdef
abcdef abcdef abcdef
Execute (absolute_dir = 0):
let g:sneak#absolute_dir = 0
call sneak#init()
norm sab
Assert sneak#state()['reverse'] == 0
Assert sneak#state()['rptreverse'] == 0
norm ;
Assert sneak#state()['reverse'] == 0
Assert sneak#state()['rptreverse'] == 0
norm ,
Assert sneak#state()['reverse'] == 0
Assert sneak#state()['rptreverse'] == 1
norm Sab
Assert sneak#state()['reverse'] == 1
Assert sneak#state()['rptreverse'] == 1
norm ;
Assert sneak#state()['reverse'] == 1
Assert sneak#state()['rptreverse'] == 1
norm ,
Assert sneak#state()['reverse'] == 1
Assert sneak#state()['rptreverse'] == 0
Execute (absolute_dir = 1):
let g:sneak#absolute_dir = 1
call sneak#init()
norm sab
Assert sneak#state()['reverse'] == 0
Assert sneak#state()['rptreverse'] == 0
norm ;
Assert sneak#state()['reverse'] == 0
Assert sneak#state()['rptreverse'] == 0
norm ,
Assert sneak#state()['reverse'] == 0
Assert sneak#state()['rptreverse'] == 1
norm Sab
Assert sneak#state()['reverse'] == 1
Assert sneak#state()['rptreverse'] == 1
norm ;
Assert sneak#state()['reverse'] == 1
Assert sneak#state()['rptreverse'] == 0
norm ,
Assert sneak#state()['reverse'] == 1
Assert sneak#state()['rptreverse'] == 1
Execute (restore g:sneak#absolute_dir default):
let g:sneak#absolute_dir = 0
call sneak#init()
###########################################################
Given:
abcdef abcdef abcdef
abcdef abcdef abcdef
abcdef abcdef abcdef
Execute (create mapping with f as a prefix / do s ; fe):
nnoremap foobar :echo 'hi'<cr>
normal sbc2;;fe;iX
nunmap foobar
Expect:
abcdef abcdef abcdef
abcdef abcdXef abcdef
abcdef abcdef abcdef
###########################################################
# label-mode
Execute (label-mode):
let g:sneak#label = 1
call sneak#init()
Given:
abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
`=QWEOIJ/+ ~~~!!! ! { } abc AAaab
abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
Do (basic label motion):
sabaD
Expect:
abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
`=QWEOIJ/+ ~~~!!! ! { } abc AAa
abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
Do (backwards label motion):
jj$Sefsix
Expect:
abcdxef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
`=QWEOIJ/+ ~~~!!! ! { } abc AAaab
abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
#TODO: feedkeys() in do_label() breaks macros/Vader
#Do (Sneak_; in label-mode):
# sab;x
#Expect:
# abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
# `=QWEOIJ/+ ~~~!!! ! { } bc AAaab
# abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
#Do (Sneak_, in label-mode):
# jsab\x
#Expect:
# abcdef ``=2Bd-a3/+ bCDef ``=2Bd-a3/+
# `=QWEOIJ/+ ~~~!!! ! { } abc AAaab
# abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
#Do (Sneak_; in visual-mode + label-mode):
# vsab;x
#Expect:
# bc AAaab
# abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
#Do (Sneak_, in visual-mode + label-mode):
# jvsab\x
#Expect:
# abcdef ``=2Bd-a3/+ =QWEOIJ/+ ~~~!!! ! { } abc AAaab
# abcdef ``=2Bd-a3/+ abCDef ``=2Bd-a3/+
Given:
| Option | Type | Default | Description |
| -- | -- | -- | -- |
| threads | Fixnum | 1 | number of threads in the thread pool |
| queues | Fixnum | 1 | number of concurrent queues |
| queue_size | Fixnum | 1000 | size of each queue |
| interval | Numeric | 0 | dispatcher interval for batch processing |
| batch | Boolean | false | enables batch processing mode |
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
| logger | Logger | nil | logger instance for debug logs |
Do (delete + label):
dznug
Expect:
number of maximum items to be assigned at once |
| logger | Logger | nil | logger instance for debug logs |
Given:
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (label + delete):
dzab;
Expect:
ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (label + delete + repeat):
dzaba
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (label + 2-delete + repeat):
2dzab\<Esc>
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (label/target/backwards/delete/repeat):
2j2wdZefs
:\<C-U>doautocmd CursorMoved\<CR>
.
Expect:
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdab3cdef ab4cdef ab5cdef ab6cdef
Do (label/target/change/repeat):
jwczefaFOO\<Esc>
:\<C-U>doautocmd CursorMoved\<CR>
jb.
Expect:
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef FOOef ab1cdef ab2cdef
ab1cdef FOOef ab5cdef ab6cdef
Execute (cleanup):
let g:sneak#label = 0
call sneak#init()
###########################################################
# unicode, multibyte
Execute (ASCII has_upper):
Assert sneak#util#has_upper("Ab")
Execute (ASCII !has_upper):
Assert !sneak#util#has_upper("ab")
Execute (cyrillic has_upper):
Assert sneak#util#has_upper("АБРАЗиЯ")
Execute (cyrillic !has_upper):
Assert !sneak#util#has_upper("абразия")
Execute (set ignorecase):
set ignorecase
set nosmartcase
let g:sneak#use_ic_scs = 1
call sneak#init()
Execute (sneak#search#get_cs):
Assert '\c' == sneak#search#get_cs('AB', 1)
Given (ASCII):
fooabAB
Do (ASCII + ignorecase):
sABix
Expect:
fooxabAB
Do (ASCII + ignorecase + repeat):
sAB;ix
Expect:
fooabxAB
Given (cyrillic):
fooабАБаб
Do:
sабix
Expect:
fooxабАБаб
Do:
sАБix
Expect:
fooxабАБаб
Do (cyrillic + ignorecase + repeat):
sАБ;ix
Expect:
fooабxАБаб
Do (cyrillic + ignorecase + repeat x2):
sАБ;;ix
Expect:
fooабАБxаб
Execute (set smartcase):
set smartcase
call sneak#init()
Given (ASCII):
fooabABaB
Do:
sABix
Expect:
fooabxABaB
Given (cyrillic):
fooабАБаБ
Do:
sабix
Expect:
fooxабАБаБ
Do:
sАБix
Expect:
fooабxАБаБ
Do:
sаБix
Expect:
fooабАБxаБ
Execute (set case-sensitive):
let g:sneak#use_ic_scs = 0
call sneak#init()
Given (ASCII):
fooAbabaB
Do:
sabix
Expect:
fooAbxabaB
Given (cyrillic):
fooаБАБаб
Do:
sабix
Expect:
fooаБАБxаб
Do:
sАБix
Expect:
fooаБxАБаб
Do:
sаБix
Expect:
fooxаБАБаб
Do:
sабix
Expect:
fooаБАБxаб
Given (kanji):
この機能を使用する場合、コマンfooド
ラインではなくてコマンドラインウィンドウから
Do:
s機能ix
Expect:
このx機能を使用する場合、コマンfooド
ラインではなくてコマンドラインウィンドウから
Do:
sooix
Expect:
この機能を使用する場合、コマンfxooド
ラインではなくてコマンドラインウィンドウから
Do:
sド\<cr>ix
Expect:
この機能を使用する場合、コマンfooxド
ラインではなくてコマンドラインウィンドウから
# https://github.com/Lokaltog/vim-easymotion/issues/28
# "If a word starts with æ, ø or å the highlighting is disturbed."
Given (Norwegian):
foo æfooæ æfooø øfoo
Do:
søfix
Expect:
foo æfooæ æfooø xøfoo
Given (random unicode):
´µµ¶·¸¹°°¡À£¨ª¦©¨ª¦¦Þ¨¦©ß©¨
foo æfïooææ ïoòôõïo ïofoo fooïo ïoïo
Do:
sææix
Expect:
´µµ¶·¸¹°°¡À£¨ª¦©¨ª¦¦Þ¨¦©ß©¨
foo æfïooxææ ïoòôõïo ïofoo fooïo ïoïo
Given (multibyte chars in various arrangements):
foo æfïooæ ïoòôõïo ïofoo fooïo ïoïo
Do:
sïo;;;;ix
Expect:
foo æfïooæ ïoòôõïo ïofoo fooxïo ïoïo
Given (adjacent multibyte chars):
foo æfïïooæ ïoòôõïo ïïofoo fïïooïo
Do:
sïï;;ax
Expect:
foo æfïïooæ ïoòôõïo ïïofoo fïxïooïo
###########################################################
# test language keymap
Execute (activate language keymap):
set keymap=bulgarian-phonetic
Given:
abcdef abcdef abcdef
абцдеф АБЦДЕФ абцдеф
абцдёё еёееёП ЯВЕРПО
абцдёё еёееёП ЯВЕРПО
Do (search for multi-keymap):
se::e::x
Expect:
abcdef abcdef abcdef
абцдеф АБЦДЕФ абцдеф
абцдё еёееёП ЯВЕРПО
абцдёё еёееёП ЯВЕРПО
Do (repeat search for multi-keymap):
se::e::;x
Expect:
abcdef abcdef abcdef
абцдеф АБЦДЕФ абцдеф
абцдёё еёееёП ЯВЕРПО
абцдё еёееёП ЯВЕРПО
Execute (deactivate language keymap):
set iminsert=0
set keymap=
###########################################################
# Sneak_f and Sneak_t
Execute (map to Sneak_f):
silent! unmap t
silent! unmap T
silent! unmap f
silent! unmap F
silent! xunmap t
silent! xunmap T
silent! xunmap f
silent! xunmap F
nmap f <Plug>Sneak_f
nmap F <Plug>Sneak_F
nmap t <Plug>Sneak_t
nmap T <Plug>Sneak_T
xmap f <Plug>Sneak_f
xmap F <Plug>Sneak_F
xmap t <Plug>Sneak_t
xmap T <Plug>Sneak_T
omap f <Plug>Sneak_f
omap F <Plug>Sneak_F
omap t <Plug>Sneak_t
omap T <Plug>Sneak_T
let g:sneak#f_reset = 0
call sneak#init()
Given:
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do ([count]f):
3feix
Expect ([count]f should NOT invoke vertical-scope):
ab1cdef ab2cdef ab3cdxef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do ([count]f):
jj3Feix
Expect ([count]F should NOT invoke vertical-scope):
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdxef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do ([count]s):
3sab;ax
Expect ([count]s SHOULD invoke vertical-scope):
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
axb1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (f-delete forward):
dfe
Expect:
f ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (f-delete invalid target):
dfZ
Expect (should not delete current char. #177):
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (t-delete forward):
dte
Expect:
ef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (f-delete-3 forward):
3dfe
Expect:
f ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (t-delete-3 forward):
3dte
Expect:
ef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (FIXME inclusive f-delete forward):
dvfe
Expect:
ef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (FIXME inclusive t-delete forward):
dvte
Expect:
def ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (exclusive f-delete backward. #121):
eedFa
Expect:
ab1cdef f ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (exclusive t-delete backward. #121):
eedTa
Expect:
ab1cdef af ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (inclusive f-delete backward. #121):
eedvFa
Expect:
ab1cdef ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Do (inclusive t-delete backward. #121):
eedvTa
Expect:
ab1cdef a ab3cdef ab4cdef ab5cdef ab6cdef
ab7cdef ab8cdef ab9cdef ab0cdef ab1cdef ab2cdef
ab1cdef ab2cdef ab3cdef ab4cdef ab5cdef ab6cdef
Execute (cleanup):
silent! unmap f
silent! unmap F
silent! unmap t
silent! unmap T
silent! xunmap f
silent! xunmap F
silent! xunmap t
silent! xunmap T
###########################################################
# test sneak mapped to 'f' (instead of default 's')
Execute (map to f):
unmap s
unmap S
nmap f <Plug>Sneak_s
nmap F <Plug>Sneak_S
let g:sneak#f_reset = 1
call sneak#init()
Given:
abcdef abcdef abcdef
# issue #35
Do (sneak 'f', then Vim default 't', then sneak 'f'):
fderxtcrx
:\<C-U>doautocmd CursorMoved\<CR>
:\<C-U>doautocmd CursorMoved\<CR>
fderx;rx
Expect:
abcxef axcxef abcxef
###########################################################
Execute (cleanup):
unmap f
unmap F
nmap s <Plug>Sneak_s
nmap S <Plug>Sneak_S
call sneak#init()