Fix backspace in vim + tmux + tcsh + konsole - vim

My shell is tcsh. I'm using vim in tmux with konsole. When I type backspace in insert mode it inserts ^?. This only happens in tmux. In konsole settings the backspace input is set to \b. I try changing it to \x8 and there is no change. fixdel doesn't help, set bs=2 in .vimrc doesn't work. I don't use setty anywhere, nor do I change the tmux keybindings. Any help? Please?

Just try :set backspace=indent,eol,start. Then, check your backspace. If this works, just put this line in your vimrc.
This works for me with Vim+tmux; I don't use Konsole or tcsh, so I can't confirm that those won't break it, but I'd be very surprised if those did.

Related

how can I stop vi from continuing comments on the next line?

I'm using vim on Centos7 with :set compatible, to make it behave like vi.
If I start a line with a # (e.g. to make a comment in a bash script), when I press return the next line also begins with #.
I don't have this annoying behavior on mac os, nor on solaris nor on cygwin. Why is Vim doing this on Centos and how can I stop it?
I assume you are using vim or neovim. Remove the r from formatoptions, e.g. instead of using :set fo=tcrqn use :set fo=tcqn.
More information:
:h fo-table

Vim line number setting not showing when using tmux

When I use vim (set number) in the .vimrc file, it works fine in the terminal, but when using tmux the line numbers just don't show.
You have to set the same $TERM for your shell and tmux. Otherwise this will cause all kinds of trouble, especially when used in connection with powerline (or vim in your case).
See: https://wiki.archlinux.org/index.php/tmux#Setting_the_correct_term
As answered by three, you have to actually set the correct $TERM for BOTH your shell and TMUX
I also had a similar problem like yours today and got it working with the following steps.
To know your current $TERM in your shell, you can use the command:
echo $TERM
for me, I got the output xterm-256color.
Then in your ~/.tmux.conf file, you can set the tmux to use xterm-256color by adding this to the file.
set -g default-terminal "xterm-256color"
and all should work fine. :)
Hope I've helped.

(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;

why my vimrc doesn't recognize <BR>

The following command in vimrc works well for vim in my ubuntu os,
:map 11 :tabnext 1<CR>
,while in my CentOS system, i entered '11', it returns:
, i have to delete '<CR>', and then enter the "Enter" key to jump to tab 1;
All the '<CR>' in vimrc doesn't work, it seems the vim can't recognize '<BR>' as "Enter" KEY, anyone help me?
Try to replace <CR> with Ctrl + VEnter.
It looks like your CentOS system starts Vim in Vi-compatible mode. To be exact, the < flag in 'cpoptions' seems to be set.
Try launching Vim via vim -N or by putting set cpo-=< before the mapping definition. If this fixes the issue, you probably want to permanently disable Vi-compatible mode, by putting set nocompatible at the top of your .vimrc.

Resources