Skip to content

Instantly share code, notes, and snippets.

@sikachu
Created October 25, 2011 20:39
Show Gist options
  • Save sikachu/1314186 to your computer and use it in GitHub Desktop.
Save sikachu/1314186 to your computer and use it in GitHub Desktop.
" Highlight Ruby 1.8.x hash rocket
" This will prevent you to ever write it again
highlight ObsoleteHashRocket ctermbg=red guibg=red
au ColorScheme * highlight ObsoleteHashRocket guibg=red
au BufEnter * match ObsoleteHashRocket /=>/
au InsertEnter * match ObsoleteHashRocket /=>/
au InsertLeave * match ObsoleteHashRocket /=>/
#!/usr/bin/ruby
Dir['**/*.{rb,erb}'].each do |filename|
content = File.read(filename)
File.open(filename, "w"){ |f| f.write content.gsub(/:([a-z0-9_]+)\s?=>/, "\\1:") }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment