Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfefcb78

Browse files
author
Dave Smith
committed
Improve performance of white space removal
On large'ish python files, this was taking 10+ secondsat save time. Now it runs instantly, even on very largepython files.Cursor position does not move.
1 parente877c7e commitfefcb78

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎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
ifpymode#Option('utils_whitespaces')
136-
auBufWritePre<buffer> :callsetline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
136+
functionPyModeTrimEndWhiteSpace()
137+
let cursor_pos=getpos('.')
138+
%s/\s\+$//
139+
callsetpos('.', cursor_pos)
140+
endfunction
141+
auBufWritePre<buffer>callPyModeTrimEndWhiteSpace()
137142
endif
138143

139144
" }}}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp