0

How to remove leading & trailing white spaces within a column range?

This doesn't work:

9s/\%>11c\%<40c^\(\s\+\)//e
9s/\%>11c\%<40c\(\s\+\)$//e
Reman
  • 7,931
  • 11
  • 55
  • 97

1 Answers1

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
oxnz
  • 835
  • 6
  • 16
  • Thanks oxnz for answering. I want to remove leading & trailing white spaces within a column range. – Reman Dec 18 '15 at 08:54