Browse files

Added a vim shortcut to unserialize PHP data.

  • Loading branch information...
L-P committed Jul 17, 2012
1 parent c55a156 commit ba013c20427c77162ac27ce2d0cc9f91fb369b66
Showing with 4 additions and 0 deletions.
  1. +4 −0 .vimrc
4 .vimrc
@@ -57,6 +57,10 @@ noremap Q  " Disable Ex mode, <Nop> won't work so I used ^V^V
nnoremap <Leader>Q :%s/=\(\x\x\<BAR>\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge<CR>
vnoremap <Leader>Q :s/=\(\x\x\<BAR>\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge<CR>
+" Print serialized PHP data as JSON.
+noremap <Leader>s ggdG:r !php -r 'echo json_encode(unserialize(file_get_contents("%")));'<CR>ggdd
+ \:set equalprg=json_reformat ft=json syntax=javascript<CR>=G
" Use arrow keys to navigate in wrapped text
nnoremap <Up> gk

0 comments on commit ba013c2

Please sign in to comment.