Ver código fonte

Handy json formatting for a .json file

Andrew Swistak 8 anos atrás
pai
commit
8e07c67bc3
1 arquivos alterados com 4 adições e 0 exclusões
  1. 4 0
      vimrc

+ 4 - 0
vimrc

@@ -125,6 +125,9 @@ vnoremap <A-k> :m '<-2<CR>gv=gv
 " Clear searches so there aren't underlined words.
 nnoremap <silent> <C-i> :nohlsearch<CR>
 
+" JSON formatting
+nmap <silent> =j :FormatJSON<CR>
+
 " Set specific directories for swap, undo, and backups.
 set backupdir=~/.vim/tmp/backup//
 set directory=~/.vim/tmp/swap//
@@ -385,3 +388,4 @@ let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
 set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim
 
 let g:vim_json_syntax_conceal = 1
+com! FormatJSON %!python -m json.tool