From: rosangelamesil@gmail.com
To: help-gnu-emacs@gnu.org
Subject: Re: Modal Keyboard Layout for EMACS
Date: Fri, 23 Nov 2012 17:56:50 -0800 (PST) [thread overview]
Message-ID: <5a0d0ec2-5dc1-401c-9817-e7cbc0e1a0db@googlegroups.com> (raw)
In-Reply-To: <5f81bc03-eafb-4330-96b1-383d17886c0c@googlegroups.com>
As I told before, I don't think it is necessary to have a separate mode to exit mvi. All one has to do is to run the command mvi-insert-mode, while in insert-mode. Make sure you see <I> in the mode-line and type:
M-x mvi-insert-mode
The above command exits mvi, and goes back to emacs keybinding. That said, below is a keybinding for Stefan's mvi-mode. The whole thing occupies 51 lines.
;; Original design by Stefan Monnier
(defvar mvi-command-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "h" 'backward-char)
(define-key map "j" 'next-line)
(define-key map "k" 'previous-line)
(define-key map "l" 'forward-char)
(define-key map "i" 'mvi-insert-mode)
(define-key map "x" 'delete-char)
(define-key map "z" 'delete-backward-char)
(define-key map "a" 'move-beginning-of-line)
(define-key map "e" 'move-end-of-line)
(define-key map "d" 'kill-whole-line)
(define-key map "p" 'yank)
(define-key map "u" 'undo)
(define-key map "v" 'set-mark-command)
(define-key map "y" 'kill-ring-save)
(define-key map "r" 'kill-region)
(define-key map "0" 'delete-window)
(define-key map "1" 'delete-other-window)
(define-key map "2" 'split-window-below)
(define-key map "o" 'other-window)
(define-key map "s" 'save-buffer)
(define-key map "w" 'write-file)
(define-key map "g" 'beginning-of-buffer)
(define-key map "G" 'end-of-buffer)
(define-key map "n" 'isearch-forward)
(define-key map "N" 'isearch-backward)
(define-key map "[" 'mvi-self-insert-command)
map))
(defun mvi-self-insert-command () (interactive)
(call-interactively 'self-insert-command)
(mvi-insert-mode 1))
(defvar mvi-insert-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "[" 'mvi-command-mode)
map))
(define-minor-mode mvi-command-mode
"Minimalistic VI-like mode."
:lighter " <N>" :global t
(when mvi-command-mode (mvi-insert-mode -1)))
(define-minor-mode mvi-insert-mode
"Emacs with a escape to VI command"
:lighter " <I>" :global t
(when mvi-insert-mode (mvi-command-mode -1)))
(provide 'mvi-command-mode)
next prev parent reply other threads:[~2012-11-24 1:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 20:04 Modal Keyboard Layout for EMACS Junia
2012-11-22 20:52 ` Junia
2012-11-22 23:21 ` Stefan Monnier
[not found] ` <mailman.13585.1353626494.855.help-gnu-emacs@gnu.org>
2012-11-23 12:55 ` sergiusruiz
2012-11-23 16:53 ` sergiusruiz
2012-11-23 18:55 ` Stefan Monnier
[not found] ` <mailman.13650.1353696942.855.help-gnu-emacs@gnu.org>
2012-11-24 0:00 ` rosangelamesil
2012-11-24 1:56 ` rosangelamesil [this message]
2012-11-24 3:16 ` rosangelamesil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a0d0ec2-5dc1-401c-9817-e7cbc0e1a0db@googlegroups.com \
--to=rosangelamesil@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.