From a20323453a60afb0cab567b7dab0ddf0429ee48a Mon Sep 17 00:00:00 2001 From: Sam Grundman Date: Wed, 13 Jun 2018 11:03:13 -0400 Subject: [PATCH] Planning how to auto-prettify JSON string --- ftplugin/json.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ftplugin/json.vim b/ftplugin/json.vim index e63e8d1..dda33e9 100644 --- a/ftplugin/json.vim +++ b/ftplugin/json.vim @@ -12,3 +12,22 @@ setlocal foldmethod=syntax foldcolumn=2 foldlevel=3 " Wrap text in double quotes nnoremap " viwa"bi"lel vnoremap " `>a"``>l + +" f,a@n +" nnoremap n qnf,aqqN@nq@n +call setreg('n', "f,a\n") +call setreg('N', "@n") + +" nnoremap c :%s/,$\@!/,\n/g:%s/\([{\[]\)\(}\|\]\|$\)\@!/\1\n/g:%s/\(^\|\[\|{\|\s\)\@ + +" /\(^\|\s\|\[\|{\)\@@b +" call setreg('b', "ni\n") +" call setreg('B', "@b") +" nnoremap b1 :g/\(^\\|\s\\|\[\\|{\)\@ + +" /[\[{]\(]\|}\|$\)\@! +" na@b +" call setreg('b', "na\n") +" call setreg('B', "@b") +" nnoremap b2 :g/[\[{]\(]\\|}\\|$\)\@!/exe "normal! na\n"