Skip to content

Commit d6b3a73

Browse files
committed
Merge pull request #137 from djsmith42/master
Improve performance of white space removal
2 parents b97cb76 + 74a6e65 commit d6b3a73

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ftplugin/python/pymode.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ endif
133133
" Utils {{{
134134

135135
if pymode#Option('utils_whitespaces')
136-
au BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
136+
function PyModeTrimEndWhiteSpace()
137+
let cursor_pos = getpos('.')
138+
:silent! %s/\s\+$//
139+
call setpos('.', cursor_pos)
140+
endfunction
141+
au BufWritePre <buffer> call PyModeTrimEndWhiteSpace()
137142
endif
138143

139144
" }}}

0 commit comments

Comments
 (0)