From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Herbert Sitz <hesitz@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: adding custom org-keymaps for EVIL Vim emulator
Date: Mon, 7 May 2012 14:42:06 +0930 [thread overview]
Message-ID: <87wr4otw0p.fsf@ucl.ac.uk> (raw)
In-Reply-To: <loom.20120229T004428-203@post.gmane.org> (Herbert Sitz's message of "Tue, 28 Feb 2012 23:50:33 +0000")
Herbert Sitz <hesitz@gmail.com> writes:
> I was playing around with Evil and like it quite a bit. It feels better than
> the previous Viper/Vimpulse package I was using, plus documentation is good,
> clear, and it seems easy to customize.
>
> One problem with Org for me has been keybindings. Even with a Vim emulator that
> does a decent job of vim-ifying Emacs, it still leaves all of the (numerous)
> Org-specific keymappings to deal with. It turns out to be quite easy to add
> custom keymappings to Org-mode to make commands accessible in a more Vim-like
> way. I've added the code below to my .emacs and it's a good start. Maybe some
> vim-friendly Org users will have ideas on how to grow it from here:
Herbert,
thanks for these. Very useful. I already had some bindings but have
added some more based on yours. My current setup is:
#+begin_src emacs-lisp
(defun esf/evil-key-bindings-for-org ()
;;(message "Defining evil key bindings for org")
(evil-declare-key 'normal org-mode-map
"gh" 'outline-up-heading
"gj" 'org-forward-same-level
"gk" 'org-backward-same-level
"gl" 'outline-next-visible-heading
"H" 'org-beginning-of-line ; smarter behaviour on headlines etc.
"L" 'org-end-of-line ; smarter behaviour on headlines etc.
"t" 'org-todo ; mark a TODO item as DONE
",c" 'org-cycle
",e" 'org-export-dispatch
",n" 'outline-next-visible-heading
",p" 'outline-previous-visible-heading
",t" 'org-set-tags-command
",u" 'outline-up-heading
"$" 'org-end-of-line ; smarter behaviour on headlines etc.
"^" 'org-beginning-of-line ; ditto
"-" 'org-ctrl-c-minus ; change bullet style
"<" 'org-metaleft ; out-dent
">" 'org-metaright ; indent
)
(mapcar (lambda (state)
(evil-declare-key state org-mode-map
(kbd "M-l") 'org-metaright
(kbd "M-h") 'org-metaleft
(kbd "M-k") 'org-metaup
(kbd "M-j") 'org-metadown
(kbd "M-L") 'org-shiftmetaright
(kbd "M-H") 'org-shiftmetaleft
(kbd "M-K") 'org-shiftmetaup
(kbd "M-J") 'org-shiftmetadown))
'(normal insert)))
#+end_src
I've been using evil now for quite a few months and I am very happy with
it. Especially for RSI sufferers, a mode based editor avoiding most C-
and M- commands is very nice.
Combined with ratpoison and keynav, my fingers seldom have to leave the
home row!
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.1.50.1
: using Org release_7.8.09-529-g035ab3.dirty
prev parent reply other threads:[~2012-05-07 5:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-28 23:50 adding custom org-keymaps for EVIL Vim emulator Herbert Sitz
2012-02-28 23:59 ` Herbert Sitz
2012-05-07 5:12 ` Eric S Fraga [this message]
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=87wr4otw0p.fsf@ucl.ac.uk \
--to=e.fraga@ucl.ac.uk \
--cc=emacs-orgmode@gnu.org \
--cc=hesitz@gmail.com \
/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.