From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: adding custom org-keymaps for EVIL Vim emulator Date: Mon, 7 May 2012 14:42:06 +0930 Message-ID: <87wr4otw0p.fsf@ucl.ac.uk> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:50525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRGF7-0003Su-CP for emacs-orgmode@gnu.org; Mon, 07 May 2012 01:12:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRGF5-0000eu-Kw for emacs-orgmode@gnu.org; Mon, 07 May 2012 01:12:16 -0400 Received: from am1ehsobe001.messaging.microsoft.com ([213.199.154.204]:19125 helo=am1outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRGF5-0000ea-An for emacs-orgmode@gnu.org; Mon, 07 May 2012 01:12:15 -0400 In-Reply-To: (Herbert Sitz's message of "Tue, 28 Feb 2012 23:50:33 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Herbert Sitz Cc: emacs-orgmode@gnu.org Herbert Sitz 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