X-Git-Url: https://plomlompom.com/repos/?p=plomvi.el;a=blobdiff_plain;f=plomvi.el;h=bda484d7a1ac73ce63163fff32f1ae6adbe41e0a;hp=70903b31b5580be28a74c8dabec4aebc4c64b7ac;hb=HEAD;hpb=777906ce4ee4f4f1d82addd1ee3d53fe894ddf0c diff --git a/plomvi.el b/plomvi.el index 70903b3..bda484d 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")) @@ -126,14 +128,18 @@ Note that this ignores killed rectangles. (defun plomvi-paste-forward () "Paste last kill rightwards in current line, or (if kill ends in \n) under it. +Doesn't move rightwards before yanking if at end of buffer. + Note that this ignores killed rectangles." (interactive) (if (eq nil (string-match "\n$" (current-kill 0))) (progn - (right-char) + (if (< (point) (point-max)) + (right-char)) (yank)) (end-of-line) - (right-char) + (if (< (point) (point-max)) + (right-char)) (yank) (previous-line))) @@ -330,3 +336,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")