diff --git a/README.md b/README.md index 591f236..e1c0bc3 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Default Keybindings - `C-c C-f`: format the region/buffer with `json-reformat` () - `C-c C-p`: display a path to the object at point with `json-snatcher` () +- `C-c P`: copy a path to the object at point to the kill ring with `json-snatcher` () Indent Width ---- diff --git a/json-mode.el b/json-mode.el index 7f7e346..ce3d018 100644 --- a/json-mode.el +++ b/json-mode.el @@ -143,6 +143,13 @@ This function calls `json-mode--update-auto-mode' to change the (define-key json-mode-map (kbd "C-c C-p") 'json-mode-show-path) +;;;###autoload +(defun json-mode-kill-path () + (interactive) + (kill-new (jsons-print-path))) + +(define-key json-mode-map (kbd "C-c P") 'json-mode-kill-path) + ;;;###autoload (defun json-mode-beautify () "Beautify / pretty-print the active region (or the entire buffer if no active region)."