'foo' : 'bar' , //= foo = 'bar' 但想用.多次运行. function ! s : var2dict (...) if a : 0 "动作" " let save_cursor = getcurpos()" execute "normal! I'\ESCea'\ESCf=r:A,\ESCj^" " call setpos('.', save_cursor)" " unlet save_c
//<=>
foo = 'bar'
但想用.多次运行.
function! s:var2dict(...)if a:0
"动作"
" let save_cursor = getcurpos()"
execute "normal! I'\<ESC>ea'\<ESC>f=r:A,\<ESC>j^"
" call setpos('.', save_cursor)"
" unlet save_cursor"
else
"安装"
let &operatorfunc = matchstr(expand('<sfile>'), '[^. ]*$')
echom &operatorfunc
return "g@\<space>"
endif
endfunction
nnoremap <expr> <leader>{ <sid>var2dict()
:h operatorfunc,此映射为,按下.时执行的操作