From: Christian Heller Date: Wed, 11 Sep 2019 00:43:42 +0000 (+0200) Subject: Use minor mode for plomvi return, default key C-c C-c C-c but customizable. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/static/task?a=commitdiff_plain;h=9ed9d03727af6bb9e3d5b4697122eebe1c10e9b4;p=plomvi.el Use minor mode for plomvi return, default key C-c C-c C-c but customizable. --- diff --git a/plomvi.el b/plomvi.el index 70903b3..28ede50 100644 --- a/plomvi.el +++ b/plomvi.el @@ -31,15 +31,17 @@ ;;; Instructions: -;; 1. load this script into your init file: (load ...) +;; 1. load this script at the end of your init file: (load ...) -;; 2. to start plomvi by default, put this into your init file: +;; 2. to start plomvi by default, put this right after: ;; (plomvi-global-mode 1) -;; 3. define some otherwise unused keybinding to simulate what would -;; be a jump back from Insert mode to Normal mode in Vim (but is de -;; facto just a plomvi mode activation), such as this: -;; (global-set-key (kbd "") 'plomvi-activate) +;; 3. if you want to use a different keybinding than "C-c C-c C-c" +;; to simulate the jump back from Insert to Normal mode in Vim (de +;; facto just a plomvi mode activation), put a line such as this +;; before the (load ...) line for plomvi (with "C-c" the desired +;; combo): +;; (defvar plomvi-return-combo (kbd "C-c")) @@ -330,3 +332,13 @@ or, on editable buffers, `plomvi-mode-editable'. The latter two's values in plomvi-mode-basic-map)) (add-to-list 'minor-mode-map-alist (cons 'plomvi-mode-editable plomvi-mode-editable-map)) + +(defvar plomvi-callable-mode-map + (let ((map (make-sparse-keymap)) + (return-combo (if (boundp 'plomvi-return-combo) + plomvi-return-combo + (kbd "C-c C-c C-c")))) + (define-key map return-combo 'plomvi-activate) + map)) +(define-minor-mode plomvi-callable-mode "" + :init-value t :keymap "plomvi-callable")