vim - 在 gVim 中插入特定字符串而不是制表符或空格
问题描述
由于我在 vim 中使用 LaTeX 文档,因此我希望能够在\quad
按下制表符时插入而不是制表符空间(而不必手动替换/插入它们)。有没有可以做到这一点的设置?如果没有,有没有像这样工作的插件?
解决方案
While you can use inoremap
to change Tab
to \quad
in insert mode, that means
that you lose the original Tab
functionality...
This might be worth it if you're sure that you'll never want to use Tab
, but
what will you do when you face a similar problem of wanting some
latex-specific text? You could try and find a second key to map... but each
addition will take up a new key that already had some function.
The way I would handle this would be to use iabbrev
to map some unlikely
sequence of keys like ;q
to \quad
:
iabbrev ;q \quad
This has the advantage that you can build up a whole set of insert mode
abbreviations, all consistently starting with ;
followed by a letter or two
that you can choose to be easily remembered. And you get to keep all the
original functionality.
推荐阅读
- laravel - 如何在laravel中显示数据库中的名称
- css - sass 编译器不工作?仍然在 width 属性中看到 calc 函数
- spring - Springboot JdbcTemplate Autowired 失败
- python - Python:从 RestAPI 下载 zip 文件
- mips - MIPS双点
- docker - 在archlinux的docker中强制更改密码但失败
- java - 运行程序并观察输出为:55 4 50 19
- botframework - 如何在 SFB 通道的节点 js 中为机器人框架添加打字指示器
- azure - Web 应用程序机器人正在发送消息“抱歉,我的机器人代码有问题”
- java - Hikari 无法获取 JDBC 连接