Skip to content

Instantly share code, notes, and snippets.

@rudle
Created September 9, 2013 03:34
Show Gist options
  • Save rudle/6491214 to your computer and use it in GitHub Desktop.
Save rudle/6491214 to your computer and use it in GitHub Desktop.
maximum-awesome patches
diff --git a/vimrc.bundles b/vimrc.bundles
index 9e9a983..829977c 100644
--- a/vimrc.bundles
+++ b/vimrc.bundles
@@ -32,6 +32,7 @@ Bundle 'tpope/vim-unimpaired'
Bundle 'tpope/vim-vividchalk'
Bundle 'uarun/vim-protobuf'
Bundle 'vim-ruby/vim-ruby'
+Bundle 'vim-scripts/align.vim'
Bundle 'vim-scripts/greplace.vim'
Bundle 'vim-scripts/kwbdi.vim'
Bundle 'vim-scripts/matchit.zip'
diff --git a/vim/plugin/whitespace/whitespace.vim b/vim/plugin/whitespace/whitespace.vim
new file mode 100644
index 0000000..7bc59d2
--- /dev/null
+++ b/vim/plugin/whitespace/whitespace.vim
@@ -0,0 +1,14 @@
+" thanks to http://vimcasts.org/e/4
+function! whitespace#strip_trailing()
+ let previous_search=@/
+ let previous_cursor_line=line('.')
+ let previous_cursor_column=col('.')
+ %s/\s\+$//e
+ let @/=previous_search
+ call cursor(previous_cursor_line, previous_cursor_column)
+endfunction
+
+" strip trailing whitespace on Ruby buffer saves
+augroup whitespace
+ autocmd BufWritePre *.rb call whitespace#strip_trailing()
+augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment