2

Steps to reproduce this:

  1. open emacs
  2. M-x shell RET
  3. vi tmpfile RET

Then you'll see the vi interface is a mess. To quit this, try to blind input :q! or just close the shell buffer.

The reason I use "vi" within emacs is that I use emacs shell-mode heavily and sometimes I ssh to another host within it. On the remote host, i have a reason to use "vi" when i need to edit some file and emacs is absent there.

Your help is appreciated.

alex
  • 799
  • 7
  • 8
  • 3
    But `emacs` has features for remote editing.... See [tramp](http://jeremy.zawodny.com/blog/archives/000983.html) – Basile Starynkevitch Sep 02 '14 at 04:43
  • Thanks for introducing me "tramp". In my case, the major requirement is to work on remote hosts over ssh and sometimes have a need to edit files there. – alex Sep 02 '14 at 09:41

1 Answers1

1

I strongly suspect that a proper terminal emulator is necessary for anything like that.

Emacs has one, happily. Try running M-x ansi-term. You can run a shell within that (the default option) and then ssh to the remote host as you were in shell mode.

(If you didn't need to change hosts then you could run vi directly, instead of a shell.)

You might also find Remote ssh connection from within Emacs useful.

You will undoubtedly want to stick to char-mode in the terminal when using vi.
See: C-hig (emacs) Terminal emulator RET

Community
  • 1
  • 1
phils
  • 71,335
  • 11
  • 153
  • 198
  • Thanks @phils, it's really helpful, this problem had bothered me a long time. – alex Sep 02 '14 at 09:27
  • The reference link is also helpful, i learnt staff from that. Yes, i would use the default char-mode when using vi, sometimes, line-mode is preferred, C-c C-o is one of my favors. – alex Sep 02 '14 at 09:34