Wednesday, September 22, 2021

Specify a range for a python command alias

Following the web page listed below I've created the following command alias in my .vimrc to conveniently prettify .json files:
command! Pj %!python -m json.tool

It works great but, ideally, I'd like to specify ranges. I tried the following:
command! -range=% Pj !python -m json.tool
But the command just hangs until such times as I Ctrl-C to abort.

I'm surprised by this since entering `3,4!python -m json.tool` at the command buffer works as expected.

What subtlety am I missing here?

Web page mentioned above:
https://pascalprecht.github.io/posts/pretty-print-json-in-vim

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CWLP265MB51867E258B0CBBF075536A5E83A29%40CWLP265MB5186.GBRP265.PROD.OUTLOOK.COM.

No comments: