如何删除领先&列范围内的尾随空格?

时间:2015-12-18 08:00:32

标签: range substitution viml

如何删除领先&在列范围内尾随空格?

这不起作用:

9s/\%>11c\%<40c^\(\s\+\)//e
9s/\%>11c\%<40c\(\s\+\)$//e

1 个答案:

答案 0 :(得分:0)

""""""""""""""""""""""""""""""""""""""""""""""""
" Delete Leading White Spaces
""""""""""""""""""""""""""""""""""""""""""""""""
function <SID>OxnzDeleteLeadingSpacesFunc()
    try
        :%s/^\s\+//
    catch /^Vim\%((\a\+)\)\=:E486/
        echo "No more leading space exists"
    endtry
endfunction

""""""""""""""""""""""""""""""""""""""""""""""""
" Delete Trailing White Spaces
""""""""""""""""""""""""""""""""""""""""""""""""
function <SID>OxnzDeleteTrailingSpacesFunc()
    try
        :%s/\s\+$//
    catch /^Vim\%((\a\+)\)\=:E486/
        echo "No more trailing space exists"
    endtry
endfunction