From 5f3b40fee35560e2e05c04385fe680ee447ad712 Mon Sep 17 00:00:00 2001 From: Vijay Edwin Date: Sun, 25 Jun 2017 02:57:44 -0700 Subject: [PATCH] function to add the selected json path to kill ring --- README.md | 1 + json-mode.el | 7 +++++++ 2 files changed, 8 insertions(+) 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)."