I'm trying to define an insert mapping like this:
inoremap <expr><buffer> ; (Test(expand('<cWORD>'))).";"
in which the
Test function is defined as:
func! Test(a) echom "cword: "."\"".a:a."\"" endfunction
For example, if the current position of the cursor is like:
When I type
;, I'm expecting a message saying:
But currently, I can only get an empty result like:
The question is why does the
expand() function here always returns an empty string?