Skip to content

Commit

Permalink
Make sure <CR> works
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Dec 11, 2014
1 parent 1b4bc70 commit 914dc03
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions autoload/incsearch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ call s:cli.connect('Digraphs')
call s:cli.connect('Delete')
call s:cli.connect('DrawCommandline')
call s:cli.connect('ExceptionExit')
" NOTE: see s:cli.keymapping()
" call s:cli.connect('Exit')
" NOTE:
" <CR> in {rhs} wil be remapped even after exiting vital-over comman line
" interface, so do not use <Over>(exit)
" See also s:cli.keymapping()
let s:incsearch_exit = {
\ "name" : "IncsearchExit",
\ "exit_code" : 0
Expand Down Expand Up @@ -178,36 +181,29 @@ endfunction
call s:cli.connect(s:pattern_saver)

function! s:cli.keymapping() abort
" NOTE:
" 'lock' doesn't be remapped if it is in the multi {rhs} mapping
" workaround: use s:incsearch_exit module and do not use `lock` fetaure
" \ "\<CR>" : {
" \ "key" : "<Over>(exit)",
" \ "noremap" : 1,
" \ "lock" : 1,
" \ },
return extend({
\ "\<Tab>" : {
\ "key" : "<Over>(incsearch-next)",
\ "noremap" : 1,
\ },
\ "\<S-Tab>" : {
\ "key" : "<Over>(incsearch-prev)",
\ "noremap" : 1,
\ },
\ "\<C-j>" : {
\ "key" : "<Over>(incsearch-scroll-f)",
\ "noremap" : 1,
\ },
\ "\<C-k>" : {
\ "key" : "<Over>(incsearch-scroll-b)",
\ "noremap" : 1,
\ },
\ "\<C-l>" : {
\ "key" : "<Over>(buffer-complete)",
\ "noremap" : 1,
\ },
\ }, g:incsearch_cli_key_mappings)
\ "\<Tab>" : {
\ "key" : "<Over>(incsearch-next)",
\ "noremap" : 1,
\ },
\ "\<S-Tab>" : {
\ "key" : "<Over>(incsearch-prev)",
\ "noremap" : 1,
\ },
\ "\<C-j>" : {
\ "key" : "<Over>(incsearch-scroll-f)",
\ "noremap" : 1,
\ },
\ "\<C-k>" : {
\ "key" : "<Over>(incsearch-scroll-b)",
\ "noremap" : 1,
\ },
\ "\<C-l>" : {
\ "key" : "<Over>(buffer-complete)",
\ "noremap" : 1,
\ },
\ "\<CR>" : {"key": "\<CR>", "noremap": 1},
\ }, g:incsearch_cli_key_mappings)
endfunction

let s:inc = {
Expand Down

0 comments on commit 914dc03

Please sign in to comment.