Vim in Emacs - macos

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.
http://dl.getdropbox.com/u/175588/emacs.png
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

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.

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")

Related

Ctrl-P doesn't work on vi mode of command line editing on mac terminal

https://www.gnu.org/software/bash/manual/html_node/Readline-vi-Mode.html
said we could do set -o vi to use vi mode instead of emacs mode for command line editing.
And the help: ex-edit-index sais
c_CTRL-P CTRL-P after using 'wildchar' with multiple matches:
go to previous match, otherwise: recall older
command-line from history.
However when I press CTRL-P I just got ^P
May I know why ?
Readline's "vi mode" is neither vi nor Vim. It is a partial emulation of vi shoehorned into the command line context.
That <C-p> you are referring to is a Vim command so there is no reason whatsoever to expect it to do anything in that context. Vim's documentation is totally irrelevant in this case.
Search for Vim Mode bindings in $ man readline for the actual bindings at your disposal in that "mode".

how do you enable command line editing with vim keys using mac terminal?

I'm reading this book and I really do not understand what this author is talking about. It appears that you can program your mac to go forward one character by either hitting l or ^F. I do not understand the difference between emac key stroke and vim keystroke. He also says run this command and 'place it in your $HOME/.bash_profile but I cannot figure out how to place the command in the bas_profile.
The Author is talking about make you terminal console behaves like vi, this means typing set -o vi in your terminal, the console will work similar vi. So you will be able to navigate using the motion keys of vi, use INSERT mode, x to delete, etc.
You can set that permanently if you include this command in your ~/.bash_profile file.
If you are not sure what it does, I don't recommend so.

How to open emacs inside zsh terminal on OSX

First of all, I use OSX.
When I use default bash and type emacs in terminal, it will open emacs inside terminal.
But when I switch to zsh, this operation will call my emacs app.
I have tried use emacs -nw, but the terminal just flash and nothing else happen.
Thanks for help me.

tmux Escape key exits server

I'm using tmux on a macOsX moutain lion (10.8)
Whenever i'm in a terminal, pressing the Escape button results in the connection to the server being lost and tmux actually exiting. I experience the same behavior regardless in iterm2, terminal and while using any of zsh, bash or a normal login shell.
That's how it looks like:
Any hints? :)
I finally figured out that it was related to iterm2-tmux integration.
As you can read here in the Usage section just below the code box, the tmux-iterm2 integration makes the ESC key actually kill tmux, unless you actually use tmux -C.
This effect was actually undersirable for me since I was not using tmux -C and the ESC key is extremely important in programs like vim or mc.

Enable zsh using 8th bit as Meta without warning

In my quest to configure my shell to work exactly how I want it with respect to the alt/meta key I am having some trouble. Recently I added "bindkey -m" to my .zshrc and now whenever I start a zsh shell (ie open a terminal window) I get this error "warning: `bindkey -m' disables multibyte support".
Now since I don't care much about multibyte support atm, is there a way I can disable just this warning? Even better would be a way to use 8th-bit meta as well as multibyte. Also note that this happens on a clean zsh install on 4.3.9 and 4.3.10
My reasoning for wanting bindkey -m
vim: alt mappings (my own personal commands/mappings)
zsh: alt mappings (such as Alt-. to recall the last argument of the previous command)
emacs: alt mappings (lots of built-ins)
So, is there any way to disable this warning or otherwise accomplish what I'm trying to do?
You can sweep the message under the rug:
bindkey -m 2>/dev/null
Don't mappings to escape (\[) also work for Alt for you? Alt-. works for me, for example, by default.
Also, unless you're talking about the command line editing modes, vim and emacs handle their own keyboard mapping. Settings in zsh won't affect them.

Resources