vim 自定义函数

"count number of words from line a:firstline to line a:lastline
function Cntws() range
    let n = 0
    let i = a:firstline
    while i <= a:lastline
        let n += len(split(getline(i)))
        let i = i + 1
    endwhile
    echo "found ".n." words"
endfunction

 

 

你可能感兴趣的:(自定义函数)