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

标签 unix vim editing

我正在使用 vim。我使用

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

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

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

谢谢

最佳答案

:help 'backspace' 是你的 friend

    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

关于unix - 无法在vim中修改重新打开的文件(文件权限不是问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6527111/

相关文章:

regex - 是否可以使用正则表达式来匹配条件?

vim - Bash:如何生成具有序号的行?

ios - 将 UITableViewCell 恢复到正常编辑模式

linux - 从 git 中删除不存在的文件

linux - 检索 `ls -la` 的符号链接(symbolic link)和目标链接

linux - 可以有多个init.pp吗?

python - Vim(python 模式)断点

c# - 有没有办法*完全*禁用编辑并继续?

bash - 我怎样才能正确地将多个 bash 脚本源到彼此?