Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename funcion to Trim. Also add TrimRange function

  • Loading branch information...
commit 63e0fb1c11b95a621890880e47dd3d52a18fa38e 1 parent 12a23fe
@graudeejs authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 vimrc
View
13 vimrc
@@ -96,22 +96,22 @@ function! PromptRemoveTrainingWhitespace()
if has_trailing_spaces
let choice = confirm("Remove trailing whitespace?", "&Yes\n&No")
if choice == 1
- call RemoveTrainingWhitespace()
+ call Trim()
let b:remove_trailing_whitespace = 1
else
let b:remove_trailing_whitespace = 0
endif
endif
elseif b:remove_trailing_whitespace == 1
- call RemoveTrainingWhitespace()
+ call Trim()
endif
endif
endfunction
"}}}
-" RemoveTrainingWhitespace() {{{
+" Trim() {{{
-function! RemoveTrainingWhitespace()
+function! Trim()
let cur_linenr = line('.')
let cur_col = col('.')
let _s=@/
@@ -122,8 +122,13 @@ function! RemoveTrainingWhitespace()
endfunction
"}}}
+" TrimRange() {{{
+function! TrimRange() range
+ exec a:firstline.",".a:lastline."substitute /\\v\\s+$//e"
+endfunction
+" }}}
" ProgrPath(prog_list) {{{
function! ProgrPath(prog_list)
Please sign in to comment.
Something went wrong with that request. Please try again.