我正在使用dragulaR创建一个应用,我希望用户能够从下拉菜单中进行选择,并且可拖动元素将从拖动区域fun! Split()
let line = getline('.')
let result = []
for l in split(substitute(line, '[{}]', '', 'g'), ",")
let result += ExpandIt(l)
endfor
let lnr = line('.')
call append(lnr, result)
exec lnr'.d'
endf
fun! ExpandIt(line)
let pat = '^\(.*\)\[\(\d\+\):\(\d\+\)\]\s*$'
if a:line !~ pat
return
endif
let exestr = substitute(a:line,pat,'range(\2,\3,-1)','g')
let text = substitute(a:line,pat,'\1','g')
exec 'let range='.exestr
let result = []
for i in range
call add(result, text.'['.i.']')
endfor
return result
endf
nnoremap <F6> :call Split()<cr>
移至拖放区域{{1} }:
如图所示的所需结果:用户从下拉列表中选择B,并将B块放置在alphaBlocks
alphaOutput