简体   繁体   English

Vim - 在插入模式下使用退格键删除空行

[英]Vim - Delete blank line using backspace in insert mode

When my cursor is placed at the start of an empty line and I press the backspace key while in insert mode, I'd expect it to wrap the the previous line.当我的 cursor 放在空行的开头并且我在插入模式下按退格键时,我希望它换行上一行。 However it stays in the same line and does nothing.但是它保持在同一条线上并且什么也不做。

I can't seem to figure out what I should add to my.vimrc file to fix this.我似乎无法弄清楚我应该在 my.vimrc 文件中添加什么来解决这个问题。

在此处输入图像描述

You can set backspace option: 您可以设置backspace选项:

:set backspace=indent,eol,start

Or 要么

:set bs=2

Are you by any chance working from a windows system? 您是否有机会在Windows系统上工作? using putty for example? 例如使用腻子?

Sometimes I've seen terminal emulators on windows mess up backspace, so it "sorta" works. 有时,我已经看到Windows上的终端模拟器弄乱了退格键,因此它可以“排序”。 Eg. 例如。 in putty, there a setting under "terminal -> keyboard" for changing how backspace works. 在腻子中,“终端->键盘”下有一个用于更改退格键工作方式的设置。 Try that. 试试看

If you manually install Vim , no matter where you are on Debian , or如果您手动安装Vim ,无论您在Debian上的哪个位置,或者

Ubuntu , or even other platform, please add the below code to your Ubuntu ,甚至其他平台,请将以下代码添加到您的

~/.vimrc (The below code works on my Debian manually installed Vim): ~/.vimrc (以下代码适用于我手动安装的 Vim Debian):

set backspace=indent,eol,start

After set nocompatible " be iMproved, required under ~/.vimrc . set nocompatible " be iMproved, required~/.vimrc下。

Notice: set backspace=2 Do Not Work on my Debian manually installed Vim.注意: set backspace=2 Do Not Work on my Debian manually installed Vim.

My Debian Manually installed Vim version is: 8.2 .我的Debian手动安装Vim版本是: 8.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM