New answers tagged

1

Not sure if this what you want, but try reading: https://vimways.org/2018/formatting-lists-with-vim/ What I have in my settings regarding list formatting: setlocal formatoptions=tcqln setlocal formatlistpat=^\\s* setlocal formatlistpat+=[ setlocal formatlistpat+=\\[({]\\? setlocal formatlistpat+=\\( setlocal formatlistpat+=[0-9]\\+ setlocal formatlistpat+=\...


0

To format in a deterministic way, we need to sort the hash. None of the other answers did that for me, so I created my own: function! FormatJson() python << EOF import vim import json try: buf = vim.current.buffer json_content = '\n'.join(buf[:]) content = json.loads(json_content) sorted_content = json.dumps(content, indent=4, ...


Top 50 recent answers are included