vim.keymap.set('n', 'jf', '%!jq', { noremap = true, silent = true, desc = 'Format with jq' }) vim.keymap.set('n', 'jm', '%!jq -c', { noremap = true, silent = true, desc = 'Minify with jq' }) -- add comma to the end of the line on new line vim.keymap.set('n', 'o', function() local line = vim.api.nvim_get_current_line() local should_add_comma = string.find(line, '[^,{[]$') if should_add_comma then return 'A,' else return 'o' end end, { buffer = true, expr = true })