Sunday, May 1, 2011

Vim in Emacs

The question does not refer to some Vim-mode in Emacs, but to Vim inside Emacs. I am not waging any Editor-war. I just want to use Vim in Emacs.

You can get to Vim in Emacs with commands "M-x term" and "vim".

When I am using the Vim-Emacs, the typing is awkward. There are odd signs, such as "4m", "4mm" and "^?^?". The backspace and the x-button in insert mode do not work. The odd signs emerge when I press the latter keys. So

How can I get Vim properly working in Emacs?

[Updated Information]

The malfunctioning Vim-Emacs is at least in the following OSs:

  • Mac OS 10.5.6
From stackoverflow
  • What you're seeing is that the terminal setting $TERM in your shell/Vim session doesn't match what the EMACS terminal is doing. Mine works fine, with the exception that the delete key is mapped to DEL, 0x127, while Vim wants ^H, 0x8. Mine shows the $TERM setting to be "eterm-color".

    Check what you have as $TERM

    $ echo $TERM

    and check the Vim docs for how to fix the backspace issue.

    Masi : I have xterm-color.
    Charlie Martin : Okay, it's probably being set by some x-specific stuff somewhere. I'm running Mac OS/X 10.5.6, Intel, and a fairly old Carbon EMACS, July of last year. Try setting your Vim terminal type explicitly and see if it's better.
  • For backspace,

    stty crt erase <CTRL-V><BACKSPACE>
    

    Worked for me.

    As for the rest, I don't know. Suppose it is something the shell outputs that the terminal doesn't handle. (Never used emacs 'term' before... prefer iTerm or Terminal.app for shell-related stuff. emacs 'term' has been called an "imperfect terminal emulator")

    Masi : Where did you put the command?
    : On the shell that popped up.

0 comments:

Post a Comment