I want to extend the easymotion Plugin to take some action after the jump. To explain to those who are not familiar with this plugin, I will use the following simplified example.
Say in a plugin UsefulPlugin the following map is defined:
function! s:Goto()
let char = nr2char(getchar())
return "f" . char
endfunction
nnoremap <expr> <Plug>(goto) s:Goto()
which does almost the same as the unmapped f
: jump to the next char input by getchar
.
Now as a user, I want to define a map that uses <Plug>(goto)
and after the user input the char, jump to that char and delete until end of line.
As an illustration: the effect of this mapping should be equivalent to
function! s:GotoAndMore()
let char = nr2char(getchar())
return "f" . char . "D"
endfunction
nnoremap <expr> fD s:GotoAndMore()
My question is: how can I achieve this with <Plug>(goto)
?
<expr>
in the first example, is that intentional? – Mass Jan 4 '19 at 3:12s:Goto
froms:GotoAndMore()
? Are they in the same script? – Ralf Jan 4 '19 at 6:23s:Goto
is provided by another plugin. My intention is to extendeasymotion
. It uses a very complex internal function. – Liu Sha Jan 4 '19 at 6:42