- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在 Ubuntu 上遇到 vim 的奇怪问题。过去几周我一直在使用它,试图在 Windows 上学习它,现在我在 Linux 上使用它时它的行为有所不同。
我注意到,在插入模式下,按退格键会像 Windows 上的任何其他编辑器一样删除文本,但在 Linux 上,文本会“删除”,但它会一直保留在那里,直到我按 ESC 键或覆盖它为止。
我试图解决这个问题,但我很困惑这是否是有意为之的行为。它也发生在 gvim 中。
这个问题的原因是这样的,然而:
我删除了我的 .vimrc 文件以查看我的配置是否有问题并修复了它。退格键现在又回到了原来的状态。
但后来我尝试创建一个空的 .vimrc 文件,这使它返回到延迟删除。它是空的。到底为什么?
所以我不知道是什么原因造成的。希望我的问题有意义我的英语不是最好的。谢谢。
好吧,看看 :h compatible 我发现了这个:
"When a |vimrc| or |gvimrc| file is found while Vim is starting up, this option is switched off, and all options that have not been modified will be set to the Vim defaults. Effectively, this means that when a |vimrc| or |gvimrc| file exists, Vim will use the Vim defaults, otherwise it will use the Vi defaults. (Note: This doesn't happen for the system-wide vimrc or gvimrc file, nor for a file given with the |-u| argument). Also see |compatible-default| and |posix-compliance|."
所以如果我做对了,运行带有 .vimrc 文件的 Vim 应该自动设置 nocompatible 并且在没有 .vimrc 文件的情况下运行它应该设置 compatible...?无论如何,我尝试检查 :verbose set compatible?它总是说不兼容,所以 -N 标志不应该做任何事情......但它解决了这个问题。
最佳答案
如果没有 vimrc,Vim 将加载 /usr/share/vim/vim80/defaults.vim
(取决于你的 vim 版本)。在此文件中,bs
/backspace
参数设置为 2
,或者实际上是 indent,eol,start
这与 2
相同(参见 :h bs
)
现在如果你创建一个空的 .vimrc
,defaults.vim
将不会被加载,所以你的 bs
可能是 0。
此行为在 :h defaults.vim
中描述
所以要解决您的问题,只需将 set bs=2
放入您的 .vimrc
关于linux - 带有空 .vimrc 的退格键的 Vim 怪异行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47072670/
我有 虚拟机 在 马克 & CentOS .所以,我看到人们在写 -xterm_clipboard , -lua , ... 有没有一种简单的方法来安装它?或者我们必须一个一个地启用选项并编译/重新编
默认情况下,Vim 在 ~/.vim 中寻找插件和其他东西。 有没有办法告诉 Vim 在 ~/.other_folder 中搜索插件等,并强制它完全忽略 ~/.vim? 最佳答案 Vim 使用来自 '
我正在尝试处理一系列文件。我注意到从命令行(即 ex 模式)运行特定命令时存在差异。例如。 $cat poo.txt big red dog small black cat $vim -c "2,$g
我正在尝试将所有与 vim 相关的文件/插件整合到 ~/.vim 中文件夹,以便我可以将其转储到 github 并开始使用病原体。但是,现在我所有的 vim 插件都散落在各处。 例如,语法插件在 /u
所以我的 ~/.vimrc 文件中的设置正确设置 set mouse=a set ttymouse=xterm2 但是,当我使用 vim 并尝试使用鼠标滚轮滚动时,命令提示符上的滚动条会移动,而不是
我试图尝试 vim 在启动时加载的自动加载文件。我将 example.vim 文件保存在: ~/.vim/autoload/ 目录并编写了一个非常简单的函数: echom "Autoloading..
这个问题已经有答案了: How can you check which options vim was compiled with? (3 个回答) 已关闭 7 年前。 我在多台计算机上使用相同的 V
我需要将一些设置和变量写入一些文本文件以供以后检索。检索文件可以是一个简单的源命令。那么从 vimscript 写入文件的最简单方法是什么? 我只想存储一些全局变量。全局的,因为它们将被多个缓冲区使用
如何使 vim 列(:set 光标列)具有不同的颜色?这是我现在看到的: 请注意,列颜色与 vim 用于标记我的身份等的颜色相同(我认为是背景颜色)。我想选择不同的颜色。 干杯:) 最佳答案 使用这个
我试图尝试 vim 在启动时加载的自动加载文件。我将 example.vim 文件保存在: ~/.vim/autoload/ 目录并编写了一个非常简单的函数: echom "Autoloading..
我正在修改已安装的 VIM 插件,并在另一个终端选项卡中测试结果。每次我想测试更改时,我都必须重新启动 VIM。 有没有更快的方法来完成这个过程?如何在 VIM 启动后重新加载 VIM 插件? 插件是
一个简单的例子: function! Foo() echom 'Starting Foo' let x = Bar(123) " Function does not exist so
有没有办法让 Vim 像带有 explorer 插件的 notepad++ 或 pspad、ultraedit 和 editplus 等其他文本编辑器一样工作? 也就是 保持文件浏览器始终在左侧(左侧
经过多次谷歌搜索后,我无法使 Vim 的代码隐藏功能与 Javascript 和 Typescript 一起使用(无需插件)。 我一直在尝试在我的 .vimrc 中使用如下行来隐藏我的代码,但没有任何
我有以下问题:在 Pycharm 中试验 vim 宏时(我使用的是 Idea Vim 插件)- 我输入了一个简单的宏并让编辑器运行它 100 次。执行速度非常慢,我无法使用 these 中的任何一个来
如何在 vim 中将字符串(4000 到 4200)替换为(5000 到 5200).. 最佳答案 另一种可能性: :%s/\v/5\1/g 这个也能做 200 次,而且由于使用了 \v switch
示例:我有一些文本,比如这个 php 代码 if(empty($condition)) { // work here... } 我的默认寄存器包含字符串“$NewCondition”。 我想将
有时我想在当前缓冲区上应用一些自定义的额外语法突出显示。 如何使用内置的 vim 语法/高亮系统来完成(我不想使用 Highlight 插件) 例如,我想突出显示当前缓冲区中的所有断言语句。 最佳答案
我有一个ora文件,它的长度为200,000行,但最后60,000行的某些行都是空白回车/空格。 我知道G会跳到文件末尾,但是我是否将vim配置为跳到非空格和非回车符的最后一行或字符? 最佳答案 G?
我想在退出vim后看到屏幕原来的内容就像打开文件之前一样,我的文件不是退出而是原始显示不存在 谢谢 最佳答案 在运行全屏应用程序后返回屏幕内容与将内容保留在那里的功能并不特定于 vi,而是特定于您的终
我是一名优秀的程序员,十分优秀!