如何在 Vim 中插入真正的制表符? [英] How can I insert a real tab character in Vim?

查看:16
本文介绍了如何在 Vim 中插入真正的制表符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的 vimrc 在这里时:

When I have my vimrc here:

set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set smarttab

而且我已经安装了 supertab 插件.每当我处于插入模式时,我按 Tab 键,它都会显示自动完成,但有时我想在像这样的字符串文字中插入一个真正的制表符.所以我的意思是每当我在双引号字符串文字中按 Tab 键时,它应该输入我们一个真正的制表符.

And I have supertab plugin installed. Whenever I am in insert mode I press tab, it shows the auto completion, but sometimes I would like to insert a real tab character in a string literal like. So what I mean whenever I press tab in double quotes string literal, it should input we a real tab character.

推荐答案

在插入模式或命令模式下(编辑器底部的 : 提示),键入 CTRL + V 然后 TAB.

While in insert mode or command mode (the : prompt at the bottom of the editor), type CTRL + V then TAB.

使用 CTRL + V 向 Vim 发出信号,它应该从字面上取下一个字符.即使在插入模式.

Using CTRL + V signals Vim that it should take the next character literally. Even in insert mode.

更新:

如 Herbert Sitz 所述,如果 gVim 处于 Windows 模式(默认),您必须使用 CRTL + Q 代替 CTRL+ V.

As noted by Herbert Sitz, if gVim is in Windows mode (default), you must use CRTL + Q in place of CTRL + V.

这篇关于如何在 Vim 中插入真正的制表符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆