Permalink
Browse files

initial commit

  • Loading branch information...
ck3g committed Jul 16, 2012
0 parents commit dfda7f1a459816b9b0f6f95e1ac88c997a7e6d05
Showing with 54 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +26 −0 README.markdown
  3. +19 −0 doc/change-hash-syntax.txt
  4. +8 −0 plugin/change-hash-syntax.vim
@@ -0,0 +1 @@
+*.swp
@@ -0,0 +1,26 @@
+# Change Hash Syntax
+
+This plugin chnages Ruby hash syntax to 1.9
+
+ # before
+ hash = { :one => 1, :two => 2 }
+
+ # after
+ hash = { one: 1, two: 2 }
+
+
+# How to use
+
+To change hash syntax, just call `:ChangeHashSyntax`. By default it
+operates on the entire file. Pass a range (or use V to select some lines)
+to restrict the portion of the file that gets fixed.
+
+# Installation
+
+ git clone git://github.com/ck3g/vim-change-hash-syntax.git
+ cp vim-change-hash-syntax/plugin/change-hash-syntax.vim ~/.vim/plugin/
+
+# Licence
+
+Distributed under the same terms as Vim itself.
+See `:help license`.
@@ -0,0 +1,19 @@
+*change-hash-syntax.txt* change-hash-syntax
+
+
+This plugin changes Ruby hash syntax to 1.9
+
+# before
+hash = { :one => 1, :two => 2 }
+
+# after
+hash = { one: 1, two: 2 }
+
+
+ *ChangeHashSyntax*
+
+To change hash syntax, just call :ChangeHashSyntax. By default it
+operates on the entire file. Pass a range (or use V to select some lines)
+to restrict the portion of the file that gets fixed.
+
+The repo is at http://github.com/ck3g/vim-change-hash-syntax
@@ -0,0 +1,8 @@
+
+function! s:ChangeHashSyntax(line1,line2)
+ let l:save_cursor = getpos(".")
+ silent! execute ':' . a:line1 . ',' . a:line2 . 's/:\([a-z0-9_]\+\)\s\+=>/\1:/g'
+ call setpos('.', l:save_cursor)
+endfunction
+
+command! -range=% ChangeHashSyntax call <SID>ChangeHashSyntax(<line1>,<line2>)

0 comments on commit dfda7f1

Please sign in to comment.