【问题标题】:vi backspace printing ^? in insert modevi 退格打印 ^?在插入模式
【发布时间】:2013-06-10 15:07:48
【问题描述】:

我使用 vi,当我处于插入模式时,它将打印 ^? 而不是实际删除文本。

我提到了这个vim backspace leaves ^?,但它并没有解决我的问题。

我在 /u/myname 目录中创建了 .vimrc 文件。
.vimrc 是否需要在某个位置?

在.vimrc中,我有

set backspace=2
set backspace=indent,eol,start

.vimrc 文件中需要包含什么内容?

【问题讨论】:

  • 您的.vimrc 应该在您的主文件夹中,即/home/ealeon/.vimrc(或简称~/.vimrc)。我不确定/u/myname 是什么意思。另外,您有什么理由使用 Vi 而不是 Vim?
  • @timss 它是一个共享服务器,所以我们每个人都有 /u/ourname 目录
  • 刚习惯用vi代替vim。我真的看不出两者之间的区别。但是您知道 .vimrc 文件中需要包含什么吗?
  • 我只能为 Vim 说话,但请查看 this answer 以检查您的 .vimrc 是否正在被读取(strace 很有趣)。也许更简单的解决方案是在您的.vimrc 中添加let test_vimrc=1 并执行:echo test_vimrc 以查看它是否存在。不确定 Vi 是否使用 vimrc,我没有一个没有 Vim 的系统(而且它似乎覆盖了我的 Vi)。
  • @FDinoff 谢谢。现在可以了。你的意思是fixdel :)

标签: vim vi


【解决方案1】:

尝试以下一些修复。这是来自:fixdel 帮助。

                            *:fix* *:fixdel*
:fix[del]       Set the value of 't_kD':
                't_kb' is     't_kD' becomes    
                  CTRL-?    CTRL-H
                not CTRL-?  CTRL-?

            (CTRL-? is 0177 octal, 0x7f hex) {not in Vi}

            If your delete key terminal code is wrong, but the
            code for backspace is alright, you can put this in
            your .vimrc:
                :fixdel
            This works no matter what the actual code for
            backspace is.

            If the backspace key terminal code is wrong you can
            use this:
                :if &term == "termname"
                :  set t_kb=^V<BS>
                :  fixdel
                :endif
            Where "^V" is CTRL-V and "<BS>" is the backspace key
            (don't type four characters!).  Replace "termname"
            with your terminal name.

            If your <Delete> key sends a strange key sequence (not
            CTRL-? or CTRL-H) you cannot use ":fixdel".  Then use:
                :if &term == "termname"
                :  set t_kD=^V<Delete>
                :endif
            Where "^V" is CTRL-V and "<Delete>" is the delete key
            (don't type eight characters!).  Replace "termname"
            with your terminal name.


                            *Linux-backspace*
            Note about Linux: By default the backspace key
            produces CTRL-?, which is wrong.  You can fix it by
            putting this line in your rc.local:
                echo "keycode 14 = BackSpace" | loadkeys


                            *NetBSD-backspace*
            Note about NetBSD: If your backspace doesn't produce
            the right code, try this:
                xmodmap -e "keycode 22 = BackSpace"
            If this works, add this in your .Xmodmap file:
                keysym 22 = BackSpace
            You need to restart for this to take effect.

如果可行,只需将 fixdel 添加到您的 vimrc。

【讨论】:

  • 但这会将退格键变成 del,不是吗?
猜你喜欢
  • 2011-11-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-20
  • 1970-01-01
相关资源
最近更新 更多