33

I've been working with VIM for decades, and I've become quite proficient in it. I was however sort-of... seduced by Emacs's org-mode, and in order to try it, I installed Emacs and Evil.

Evil satisfies most of my VIM-related muscle memory, so I proceeded with my testing of org-mode - and met my first issue: when I spawn Emacs in its own window (i.e. emacs plan.org) then the TAB key works, opening and closing my plan's sections just fine. However, TAB does nothing when I use Emacs in text mode (i.e inside my XTerms, via "emacs -nw plan.org"). And that's the state that I am mostly interested in, since I usually work from inside screen/tmux over SSH connections.

If it's a conflict with Evil-mode, I don't understand why - I am unaware of any TAB functionality in VIM's normal mode (which is what we're in when opening/closing org-mode sections).

Any Emacs-guru out there with a suggestion on why this happens?

ttsiodras
  • 10,602
  • 6
  • 55
  • 71

3 Answers3

43

Try

(setq evil-want-C-i-jump nil)

in your ~/.emacs before

(require 'evil) 

Evil has, in evil-maps.el

(when evil-want-C-i-jump
  (define-key evil-motion-state-map (kbd "C-i") 'evil-jump-forward))

That should give you org-mode Tab functionality back

Brian Tiffin
  • 3,978
  • 1
  • 24
  • 34
2

I have almost no experience with terminals. However, I know that TAB is equivalent to C-i. Maybe that one would go through the terminal? If that works, you could add some key bindings for every TAB operation?

Try maybe C-h k TAB as well to see if TAB if sent on the wire.

fniessen
  • 4,408
  • 19
  • 18
  • Tried C-i, didn't do anything. I then tried C-h k TAB, but when I hit 'C-h', I get a 'Beginning of line' message printed at the bottom line - maybe Evil intercepts this key combo? – ttsiodras Apr 06 '14 at 18:13
  • After further investigation: you probably meant C-c C-i (sorry, I am rather ignorant in Emacs things), which *does* work. Is there anything I can add to my .emacs to map 'TAB' to C-c C-i when run under consoles? (XTerms, etc) – ttsiodras Apr 07 '14 at 08:04
  • you can do that: `(define-key org-mode-map (kbd "") 'org-cycle)`. Indeed TAB didn't work in the console (was bound to evil-jump-forward). – Ehvince Apr 07 '14 at 09:03
  • 2
    or try (define-key org-mode-map (kbd "C-i") 'org-cycle)? – fniessen Apr 07 '14 at 09:08
0
 (define-key evil-normal-state-map (kbd "M-i") 'evil-jump-forward)
 (define-key evil-normal-state-map (kbd "M-o") 'evil-jump-backward)

I bind the function to other keys, so it's also work.