From b08fb429e5815c457316371d5a2d0004dd9d9774 Mon Sep 17 00:00:00 2001 From: t14 Date: Mon, 18 Nov 2024 20:08:36 +0100 Subject: [PATCH] vimrc: add keybind for formatting JSON with jq --- .vim/vimrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.vim/vimrc b/.vim/vimrc index 8367a64..e988c8d 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -874,6 +874,15 @@ nmap tl :TestLast nmap g :TestVisit +""" formatingt with jq as per https://davidisaksson.dev/posts/format-json-in-vim/ +" Whole buffer +nnoremap fj %!jq +nnoremap fcj %!jq --compact-output +" Visual selection +vnoremap fj :'<,'>!jq +vnoremap fcj :'<,'>!jq --compact-output + + " partially superseded by jasonccox/vim-wayland-clipboard (for "+) " still keeping the "* mappings " it however breaks