Closed bimlas closed 6 years ago
Reason for this pull request: I'm developing a Vim plugin which can be used to search files by tag name where tags are part of filenames. A feature of it is to use inside Unite.
When popupmenu (completion menu) is shown, disable Unite insert mode mappings because those conflicting with menu navigating mappings (<C-n>, <C-p>, <C-j>, etc.).
<C-n>
<C-p>
<C-j>
I tried to refactor in to a function, but it's not prettier:
call s:pum_safe_map('imap <buffer>', '<TAB>', \ '<Plug>(unite_choose_action)') function! s:pum_safe_map(mode, lhs, rhs) abort "{{{ execute a:mode.' '.a:lhs.' pumvisible() ? "'.a:lhs.'" : "'.a:rhs.'"' endfunction
Besides this it can be rigid; changing the quotes in rhs will produce error. For example using " in rhs instead of ':
rhs
"
'
call s:pum_safe_map('inoremap <silent><buffer><expr> ', '<C-d>', \ 'unite#do_actioc("delete")'
It would evaulate to:
inoremap <silent><buffer><expr> <C-d> pumvisible() ? "<C-d>" : "unite#do_actioc("delete")"
This is the broken part: "unite#do_actioc("delete")"
"unite#do_actioc("delete")"
Reason for this pull request: I'm developing a Vim plugin which can be used to search files by tag name where tags are part of filenames. A feature of it is to use inside Unite.
When popupmenu (completion menu) is shown, disable Unite insert mode mappings because those conflicting with menu navigating mappings (
<C-n>
,<C-p>
,<C-j>
, etc.).I tried to refactor in to a function, but it's not prettier:
Besides this it can be rigid; changing the quotes in
rhs
will produce error. For example using"
inrhs
instead of'
:It would evaulate to:
This is the broken part:
"unite#do_actioc("delete")"