Screen + vim causes shift-enter to insert 'M' and a newline

泪湿孤枕 提交于 2019-12-09 10:23:51

问题


When running a vim instance in gnu screen hitting shift enter in insert mode adds an 'M' and then a newline, rather than just a newline.

Does anybody know what the problem might be, or where to look?

Relevant system info:

Ubuntu 8.04.1

Screen version 4.00.03 (FAU) 23-Oct-06

VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 31 2008 12:20:21) Included patches: 1-138

Konsole 1.6.6 (Using KDE 3.5.10)

Thanks to the comments. When checking the value of $TERM I noticed that it was xterm (as expected), but within screen $TERM was set to screen-bce. Setting TERM=xterm after launching screen resolves this issue.

Adding the following to ~/.screenrc solved the problem without having to do anything manually:

term xterm


回答1:


Missing info from your question:

  1. Where do you run screen and see this issue? Some terminal app (KTerminal, Gnome terminal, virtual console etc) or remote session (eg putty, ssh from another computer)
  2. do a “echo $TERM” and tell us its output
  3. do a “cat -v”, press Shift-Enter, then Enter, then Ctrl-D and then tell us what is output.



回答2:


First, you could fix your $TERM for within konsole. Install "ncurses-term" and configure konsole to set $TERM=konsole-256color. Then configure screen with "term screen-256color". Or 'konsole' and 'screen', respectively, if that's your preference. Konsole and screen are not xterm and doesn't support everything xterm does, so using incorrect $TERM can lead to bad things.



来源:https://stackoverflow.com/questions/63378/screen-vim-causes-shift-enter-to-insert-m-and-a-newline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!