Added ,ws to strip trailing whitespace in a file
This commit is contained in:
@@ -37,7 +37,7 @@ nnoremap ,. '.
|
||||
|
||||
" ================== rails.vim
|
||||
"
|
||||
" Open corresponding unittest (or spec), alias for :AV in rails.vim
|
||||
" Open corresponding unittest (or spec), alias for :AV in rails.vim
|
||||
nmap ,ru :AV<CR>
|
||||
|
||||
" ==== NERD tree
|
||||
@@ -78,8 +78,8 @@ nnoremap <silent> K :GitGrep <cword><CR>
|
||||
" ==============================
|
||||
" Window/Tab/Split Manipulation
|
||||
" ==============================
|
||||
" Move between split windows by using the four directions H, L, I, N
|
||||
" (note that I use I and N instead of J and K because J already does
|
||||
" Move between split windows by using the four directions H, L, I, N
|
||||
" (note that I use I and N instead of J and K because J already does
|
||||
" line joins and K is mapped to GitGrep the current word
|
||||
nnoremap <silent> H <C-w>h
|
||||
nnoremap <silent> L <C-w>l
|
||||
|
||||
15
vim/plugin/settings/whitespace-killer.vim
Normal file
15
vim/plugin/settings/whitespace-killer.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
" via: http://rails-bestpractices.com/posts/60-remove-trailing-whitespace
|
||||
" Strip trailing whitespace
|
||||
function! <SID>StripTrailingWhitespaces()
|
||||
" Preparation: save last search, and cursor position.
|
||||
let _s=@/
|
||||
let l = line(".")
|
||||
let c = col(".")
|
||||
" Do the business:
|
||||
%s/\s\+$//e
|
||||
" Clean up: restore previous search history, and cursor position
|
||||
let @/=_s
|
||||
call cursor(l, c)
|
||||
endfunction
|
||||
command! StripTrailingWhitespaces call <SID>StripTrailingWhitespaces()
|
||||
nmap ,ws :StripTrailingWhitespaces<CR>
|
||||
Reference in New Issue
Block a user