vim backspace not working after stty erase ^? - vim

Since backspace in vim was giving me ^? instead of working as a backspace, I put the following in .cshrc to make it work:
stty erase ^?
Now the problem is that when I open a gnome-terminal from my linux machine, the backspace still does not work in vim. However if I run tcsh on my shell, and reopen vim, backspace does work. If I open a gnome-terminal tab in the already open terminal, or open a new terminal window from the already open terminal on which tcsh was run, I don't see the issue. Could anyone tell me what might be going on?

Related

Using vim keys in zsh terminal, how to exit "excute:_" mode?

I have recently switched to vim style key binding for my terminal by placing set -o vi in my .zshrc file. When using it I find myself in this "excute:_" mode after pressing Esc and then : , the terminal then looks like this:
[I] ➜
execute: _
What is this mode and how do I exit it?
I have looked here and here for answers to no avail. I also asked in the vim stack exchange and got told to move.
I think it's called the vicmd mode. You can execute commands from the ZLE (Zsh Line Editor).
For example, you can type ed then TAB for completion which should write edit-command-line and if you run it, it will open your editor to edit the current line (as the name suggest).
You can go back to normal mode with ctrl + c

How to close gvim from command prompt

Usually, we open gvim from the command line like this:
gvim someFile.txt
But how are we going to close it from command line too? Instead of closing it from gvim itself?
I wanted to do some automation, hence, will need to close it from command line.
gVIM has the ability to act in client/server manner. That means you can send commands to a running vim.
Do the following
Start GVIM, open a document, do whatever
Run the following command to close GVIM
vim --servername GVIM --remote-send '<C-\><C-N>:wq<CR>'
That will save the file in GVIM and close GVIM.
First, why are you automating using a gui application?
But you can close it by sending it either <ESC>ZZ or :q!

(tmux+vim) vim didn't clear it's screen after exiting in tmux

In the tmux shell, after exiting vim, the vim screen is not cleared. I'm using zsh. It works fine without using tmux.
The same problem is also happen with screen.
I'm using vim 7.3.672, tmux 1.7, all with default configuration.
Put this line in your .screenrc:
altscreen on
Then screen will clear the VIM content when VIM exits.
With tmux, it should work out of the box.
PS. this is my .tmux.conf, in case you find anything interesting in it.
Put the following line in your .zshrc, and restart terminal.
export TERM=xterm
It works for me.

ESC doesn't work in cygwin vim

I installed cygwin on Windows 7. When I start vim in cygwin terminal it starts in interactive mode. I can't change mode to command one by pressing ESC. What could be the reason?
UPDATE:
Also vim prints these varnings at start:
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal
If by interactive mode you mean insert mode (where keypresses are inserted as text, just as in other editors), then your Vim is in easy mode.
In it, you can temporarily execute normal mode commands via Ctrl + O. But I guess you don't want this strange beginner's mode. To turn it off, check whether Vim has been invoked with the -y argument or as evim (is there a shell alias?). Or, if you find a :set insertmode command in a .vimrc, remove it. (By default, at least in my Cygwin installations, Vim is not configured for easy mode, so it must be something in your configuration.)
Try to
Press “ESC” and "shift" and ":" together;
You should find the place that you can type command line in vim;

GNU Screen and vim - connect over ssh from different hosts, certain buttons (e.g. <ENTER>, ^[ ) don't work correctly

Both clients are Windows 7 using cygwin to connect to an Ubuntu machine.
From ClientA I connect via ssh to the Ubuntu machine, start a screen session, and open vim. Then I type :E to open the netrw directory listing. Pressing <ENTER> on the directories navigates and all is good in the world. I disconnect from the Screen session.
From ClientB, I connect via ssh and resume the screen session, vim is already open. I press <ENTER> on a directory and instead of opening the directory, it moves the cursor down one line. It's as if I've pressed j or <DOWN>. Pressing ^M does the same thing. None of the directories can be navigated to. Also, if I have a file open and I'm in insert mode, I have to press escape twice to return to normal mode.
Still on CLientB, I quit vim :q (yes, enter works when typing : commands). I then reopen vim and use netrw again :E. Now everything works the way it's supposed to: pressing <ENTER> navigates directories, and when I'm editing files I only need to press ^[ or escape once for it to work.
If I disconnect from ClientB and connect again with ClientA, then vim doesn't work properly again until I exit vim and start it again.
I have tried typing :set to see all of the set options, but there is no difference between these settings when vim is started while connected from ClientA or ClientB.
What is going on and how can I fix it?
Thanks!
In cygwin I needed to go to Options > Terminal and make sure both clients were set to the same type (e.g. xterm-256color).
Different terminal types use different escape sequences for the keys and the mismatch was causing the problem.

Resources