;;; 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 "<f1>") '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"))
(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)))
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")