diff rc/vimrc @ 467:8ef5ddb9b54b

Support for json
author Edho Arief <edho@myconan.net>
date Fri, 24 May 2013 18:47:59 +0900
parents 57b104afb2ac
children 86873b811343
line wrap: on
line diff
--- a/rc/vimrc	Tue May 14 16:04:09 2013 +0900
+++ b/rc/vimrc	Fri May 24 18:47:59 2013 +0900
@@ -37,6 +37,9 @@
 nmap _cs :let @/ = ''<cr>
 nmap _pa :set number! list!<cr>
 
+" format JSON
+map <leader>j <esc>:%!python -m json.tool<cr>
+
 "autocmd VimEnter * NERDTree
 "autocmd BufEnter * NERDTreeMirror
 
@@ -50,6 +53,16 @@
 endif
 
 if has("autocmd")
+  augroup json_autocmd
+    autocmd!
+    autocmd FileType json set autoindent
+    autocmd FileType json set formatoptions=tcq2l
+    autocmd FileType json set textwidth=78 shiftwidth=2
+    autocmd FileType json set softtabstop=2 tabstop=8
+    autocmd FileType json set expandtab
+    autocmd FileType json set foldmethod=syntax
+  augroup END
+  au! BufRead,BufNewFile *.json set filetype=json
   autocmd BufRead,BufNewFile supervisord.conf :set ft=dosini
   autocmd BufRead,BufNewFile Gemfile :set ft=ruby
   autocmd BufRead,BufNewFile config.ru :set ft=ruby