无法在vim中修改重新打开的文件(文件权限不是问题)

时间:2011-06-29 20:51:48

标签: unix vim editing

我正在使用vim。我使用

创建了一个新的cpp文件
vim xyz.cpp

打开文件后,我添加了一些基本的包含和注释。然后我关闭它(:wq!)并重新打开它,发现我无法删除/编辑以前写入的命令,即使在按下 i (用于插入)< / strong>,虽然它进入插入模式,但我能够将新文本添加到文件中。我必须说,当我不处于插入模式时,我可以通过按 x 删除单个字符。但它并没有解决我的问题。

我检查了文件权限,它说-rwxrwxrwx,所以我不认为权限是问题。以前有没有人遇到过这个问题。任何形式的帮助将不胜感激。

由于

1 个答案:

答案 0 :(得分:4)

:help 'backspace'是你的朋友

    Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
    mode.  This is a list of items, separated by commas.  Each item allows
    a way to backspace over something:
    value   effect  ~                               
    indent  allow backspacing over autoindent
    eol     allow backspacing over line breaks (join lines)
    start   allow backspacing over the start of insert; CTRL-W and CTRL-U
            stop once at the start of insert.

    When the value is empty, Vi compatible backspacing is used.

尝试将其设置为

 set backspace=indent,eol,start