diff --git a/dot_config/vim/README.md b/dot_config/vim/README.md index 86d0916..f659670 100644 --- a/dot_config/vim/README.md +++ b/dot_config/vim/README.md @@ -84,7 +84,7 @@ Below is a list of currently installed plugins: | `` | Remove trailing whitespace from file | | | `a` | Accept various common delimiters for tabulizing blocks of code (e.g. `varname = something`, = being the delimiter) | Tabular | | `d` | Add delimiters around entire line (normal mode) or selection (visual mode) | vim-surround | -| `j` | Pretty print json (current open file) | | +| `fj` | Pretty print json using jq (current open file) | | | `D` | Add delimiters around current word (normal mode) | vim-surround | | `q` | Format a paragraph/line to better fit the textwidth | | | `p` | Toggle paste mode | | diff --git a/dot_config/vim/vimrc b/dot_config/vim/vimrc index f8ed6b0..9be0d3d 100644 --- a/dot_config/vim/vimrc +++ b/dot_config/vim/vimrc @@ -263,7 +263,12 @@ nmap d yss nmap D ysiw - nnoremap j :%!python -m json.tool " Pretty print json + " Format Commands (start with f for format) + " nnoremap j :%!python -m json.tool " Use python for pretty printing json + nnoremap fj %!jq " Use jq for pretty printing JSON file + nnoremap fcj %!jq --compact-output + vnoremap fj :'<,'>!jq " Use jq for pretty printing JSON selection + vnoremap fcj :'<,'>!jq --compact-output " 06 - Neovim LSPs if has('nvim')